tmandeville - Tuesday, December 20, 2011 3:57 AM:
Hi
I'm looking for a way to manage the promotion of items that have dependent items that must be attached to the parent item and at be at the correct promotion level before I can promote the parent item.
This is to cover multiple relationship Part to Part via part Bom, Part to MFG Part via the Part and AML Bom, and MFG Part to Manufacturer.
Is there an existing method that already exists (amd can be modified to our custom life cycle states) or has anybody written some code for this.
Trevor
AdamStrachan - Tuesday, December 20, 2011 7:05 PM:
Somebody will likely have code to manage this, but it change depending on what you actually require.
My solution would be:
On the parent item, add a method to the lifecycle transition between the two states (pre promotion).
The method will have an algorithm something like:
Get the relationships with a "source_id" equal to the parent item ID ( this.getID() )
Get the related items for each of these relationships.
Check the "state" property of each of the related items to see if it matches what you require.
If any don't match the required state, return with an error and the promotion will be cancelled.
This should get you started, let me know if you need more help.
Adam