Forum Discussion
Thanks for replying but it doesn't work, I get sliglty different output though. Previously, the output would contain the existing document.
Adding your snippet doesn't return mpp_operationDocument. It could be because we are editing and not "getting".
I tried your snippet with "edit" and "update", the result is the same, no mpp_operationDocument.
Do I need to declare <source_id>? I tried that too. I added this line
<Item type="mpp_processPlan" action="get">
<source_id>
<item_number>080824-S10</item_number>
</source_id>
This returns mixed up data for different process plans and operations, and not specificially for 080824-S10.
My complete code with your snippet and output is:
code:
[embed:dc8ab71f-3b98-42d9-b0f6-e21e02a0f8e2:d5661bf8-f89e-46d4-ac51-11ce51f71763:type=xml&text=%3CAML%3E%0A%3CItem%20type%3D%22mpp_processPlan%22%20action%3D%22get%22%3E%0A%3Citem_number%3E080824-S10%3C%2Fitem_number%3E%0A%3CRelationships%3E%0A%3CItem%20type%3D%22mpp_Operation%22%20action%3D%22get%22%3E%0A%3Csort_order%3E20%3C%2Fsort_order%3E%0A%3CRelationships%3E%0A%3CItem%20type%3D%22mpp_operationDocument%22%20action%3D%22update%22%3E%0A%3Crelated_id%3E%0A%3CItem%20type%3D%22Document%22%20action%3D%22get%22%3E%0A%3Citem_number%3EMADL074161%3C%2Fitem_number%3E%0A%3C%2FItem%3E%0A%3C%2Frelated_id%3E%0A%3C%2FItem%3E%0A%3C%2FRelationships%3E%0A%3C%2FItem%3E%0A%3C%2FRelationships%3E%0A%3C%2FItem%3E%0A%3C%2FAML%3E]
Output: As you can see there is no mpp_operationDocument in this
[embed:dc8ab71f-3b98-42d9-b0f6-e21e02a0f8e2:e3f5316f-e171-4b83-90ca-59d25369b80e:type=xml&text=%3CSOAP-ENV%3AEnvelope%20xmlns%3ASOAP-ENV%3D%22http%3A%2F%2Fschemas.xmlsoap.org%2Fsoap%2Fenvelope%2F%22%3E%0A%3CSOAP-ENV%3ABody%3E%0A%3CResult%3E%0A%3CItem%20type%3D%22mpp_ProcessPlan%22%20typeId%3D%224E030A4723224002B3E94F40F01AC1DE%22%20id%3D%22767F3FCDCC0F4CCF95F3CA3D9DB9D391%22%3E%0A%3Cconfig_id%20keyed_name%3D%22080824-S10%22%20type%3D%22mpp_ProcessPlan%22%3E767F3FCDCC0F4CCF95F3CA3D9DB9D391%3C%2Fconfig_id%3E%0A%3Ccreated_by_id%20keyed_name%3D%22Data%20Migration%22%20type%3D%22User%22%3E08880028FF8C43D48CB02B44EB74B127%3C%2Fcreated_by_id%3E%0A%3Ccreated_on%3E2024-02-20T11%3A49%3A02%3C%2Fcreated_on%3E%0A%3Ccurrent_state%20name%3D%22Released%22%20keyed_name%3D%22Released%22%20type%3D%22Life%20Cycle%20State%22%3E7109CDD337C84AFF87F55B21CCAC34AC%3C%2Fcurrent_state%3E%0A%3Cdescription%3E%3C%2Fdescription%3E%0A%3Cgeneration%3E1%3C%2Fgeneration%3E%0A%3Chas_change_pending%3E0%3C%2Fhas_change_pending%3E%0A%3Cid%20keyed_name%3D%22080824-S10%22%20type%3D%22mpp_ProcessPlan%22%3E767F3FCDCC0F4CCF95F3CA3D9DB9D391%3C%2Fid%3E%0A%3Cis_current%3E1%3C%2Fis_current%3E%0A%3Cis_released%3E1%3C%2Fis_released%3E%0A%3Ckeyed_name%3E080824-S10%3C%2Fkeyed_name%3E%0A%3Clocation%3E10%3C%2Flocation%3E%0A%3Cmajor_rev%3EPP000%3C%2Fmajor_rev%3E%0A%3Cmodified_on%3E2024-02-20T11%3A49%3A02%3C%2Fmodified_on%3E%0A%3Cname%3ESlitter%20Knife%20Arm%2C%20Rotary%20Tip%2C%2035%22%20Ring%2C%20C%2FR%3C%2Fname%3E%0A%3Cnew_version%3E1%3C%2Fnew_version%3E%0A%3Cnot_lockable%3E0%3C%2Fnot_lockable%3E%0A%3Cowned_by_id%20keyed_name%3D%22Mfg%20Eng%22%20type%3D%22Identity%22%3ED46B8ECBDB0C4D94BFF7A93D36FAB474%3C%2Fowned_by_id%3E%0A%3Cpermission_id%20keyed_name%3D%22Process%20Plan%20-%20Released%22%20type%3D%22Permission%22%3EE4EB045B2622409BA09AC91778FAE18C%3C%2Fpermission_id%3E%0A%3Crelease_date%3E2024-01-29T00%3A00%3A00%3C%2Frelease_date%3E%0A%3Cstate%3EReleased%3C%2Fstate%3E%0A%3Citem_number%3E080824-S10%3C%2Fitem_number%3E%0A%3Citemtype%3E4E030A4723224002B3E94F40F01AC1DE%3C%2Fitemtype%3E%0A%3CRelationships%3E%0A%3CItem%20type%3D%22mpp_Operation%22%20typeId%3D%2291B674D7C7AF47F99CA1C2FB26C38DBF%22%20id%3D%2277DD37200C7B4858833A6D6D8A48F4FA%22%3E%0A%3Cconfig_id%20keyed_name%3D%2220%22%20type%3D%22mpp_Operation%22%3E77DD37200C7B4858833A6D6D8A48F4FA%3C%2Fconfig_id%3E%0A%3Ccreated_by_id%20keyed_name%3D%22Data%20Migration%22%20type%3D%22User%22%3E08880028FF8C43D48CB02B44EB74B127%3C%2Fcreated_by_id%3E%0A%3Ccreated_on%3E2024-02-20T12%3A06%3A27%3C%2Fcreated_on%3E%0A%3Ccycle_time%3E60%3C%2Fcycle_time%3E%0A%3Cdescription%20xml%3Alang%3D%22en%22%3EMC-1B%20MC2%20CNC%20Machine%20Centre%20S10%3C%2Fdescription%3E%0A%3Cgeneration%3E1%3C%2Fgeneration%3E%0A%3Cid%20keyed_name%3D%2220%22%20type%3D%22mpp_Operation%22%3E77DD37200C7B4858833A6D6D8A48F4FA%3C%2Fid%3E%0A%3Cis_current%3E1%3C%2Fis_current%3E%0A%3Cis_released%3E0%3C%2Fis_released%3E%0A%3Ckeyed_name%3E20%3C%2Fkeyed_name%3E%0A%3Cmajor_rev%3EPP000%3C%2Fmajor_rev%3E%0A%3Cmodified_on%3E2024-02-20T12%3A06%3A27%3C%2Fmodified_on%3E%0A%3Cname%20xml%3Alang%3D%22en%22%3EMC-1B%3C%2Fname%3E%0A%3Cnew_version%3E1%3C%2Fnew_version%3E%0A%3Cnmg_erp_name%3EMC-1B%3C%2Fnmg_erp_name%3E%0A%3Cnmg_location_id%3E10%3C%2Fnmg_location_id%3E%0A%3Cnot_lockable%3E0%3C%2Fnot_lockable%3E%0A%3Cpermission_id%20keyed_name%3D%22Process%20Plan%20-%20Released%22%20type%3D%22Permission%22%3EE4EB045B2622409BA09AC91778FAE18C%3C%2Fpermission_id%3E%0A%3Csetup_time%3E0%3C%2Fsetup_time%3E%0A%3Csource_id%20keyed_name%3D%22080824-S10%22%20type%3D%22mpp_ProcessPlan%22%3E767F3FCDCC0F4CCF95F3CA3D9DB9D391%3C%2Fsource_id%3E%0A%3Cwi_details%20xml%3Alang%3D%22en%22%3E%3C%2Fwi_details%3E%0A%3Csort_order%3E20%3C%2Fsort_order%3E%0A%3C%2FItem%3E%0A%3C%2FRelationships%3E%0A%3C%2FItem%3E%0A%3C%2FResult%3E%0A%3C%2FSOAP-ENV%3ABody%3E%0A%3C%2FSOAP-ENV%3AEnvelope%3E%0A]
Ah I see. There are two options.
The most reliable way is to edit the complete chain (edit ProcessPlan, edit Operation, edit DocRelationship with a Document you get). For editing an item, you also need to use "where" to specify which element you want to edit.
[embed:dc8ab71f-3b98-42d9-b0f6-e21e02a0f8e2:7b6abc98-a21a-4eb3-b111-74e4dee04e6b:type=xml&text=%3CAML%3E%0A%3CItem%20type%3D%22mpp_processPlan%22%20action%3D%22edit%22%20where%3D%22%5Bmpp_processPlan%5D.item_number%3D%27123%27%22%3E%0A%3CRelationships%3E%0A%3CItem%20type%3D%22mpp_Operation%22%20action%3D%22edit%22%3E%0A%3Csort_order%3E20%3C%2Fsort_order%3E%0A%3CRelationships%3E%0A%3CItem%20type%3D%22mpp_operationDocument%22%20action%3D%22edit%22%3E%0A%3Crelated_id%3E%0A%3CItem%20type%3D%22Document%22%20action%3D%22get%22%3E%0A%3Citem_number%3EMADL074161%3C%2Fitem_number%3E%0A%3C%2FItem%3E%0A%3C%2Frelated_id%3E%0A%3C%2FItem%3E%0A%3C%2FRelationships%3E%0A%3C%2FItem%3E%0A%3C%2FRelationships%3E%0A%3C%2FItem%3E%0A%3C%2FAML%3E]
Or you just edit the relationship itself with source_id and related_id. An AML query without the parent levels of the chain would work, but have to know the source_id or get it based on the Operation (which is probably not a unique item). I personally would use the first option.
- Hargul_Sidhu2 years agoIdeator I
Awesome! I made it work with some tweaks. Apparently I need to use "id" for mpp_operation only, regardles of "update", "edit" or "add" action for mpp_operation, otherwise I get this error
<faultstring><![CDATA[Mandatory attribute "id" is missed at mpp_Operation item node]]></faultstring>Any way to make this work without using id. I have a csv file to upload and it doesn't contain the IDs. The idea was to try out AML and if it works copy paste it in the batch-loader.
Script:
[embed:dc8ab71f-3b98-42d9-b0f6-e21e02a0f8e2:7d7fbdf2-320d-403b-9c3e-ec330dfbf937:type=xml&text=%3CAML%3E%0A%3CItem%20type%3D%22mpp_processPlan%22%20action%3D%22edit%22%20where%3D%22%5Bmpp_processPlan%5D.item_number%3D%27D52229-S10%27%22%3E%0A%3CRelationships%3E%0A%3CItem%20type%3D%22mpp_Operation%22%20action%3D%22%22%3E%0A%3Csort_order%3E30%3C%2Fsort_order%3E%0A%3CRelationships%3E%0A%3CItem%20type%3D%22mpp_operationDocument%22%20action%3D%22add%22%3E%0A%3Crelated_id%3E%0A%3CItem%20type%3D%22Document%22%20action%3D%22get%22%3E%0A%3Citem_number%3EMADL109444%3C%2Fitem_number%3E%0A%3C%2FItem%3E%0A%3C%2Frelated_id%3E%0A%3C%2FItem%3E%0A%3C%2FRelationships%3E%0A%3C%2FItem%3E%0A%3C%2FRelationships%3E%0A%3C%2FItem%3E%0A%3C%2FAML%3E]