how to stop the workflow status from pending to submit through code
In an assembly the parent attribute value is not matching the BOM attribute value. When the user clicks the SUBMIT status button in the ECO workflow it should validate the condition above and should not change the status to SUBMIT. In other words the status must remain as PENDING till both Parent and BOM attribute values match up. How to achieve this using SDK. Please help.
Read and practice on doing basic SDK code per Oracle documentation on Agile PLM SDK/px
Setup System Event , Event Handler , Event Subscription to launch your very simple PX that display an Exception message every time to verify that your PX code runs.
Disable the Event subscription once you know the PX is being triggered.
I am assuming that you know how to use eclipse to create a jar with correct META-INF/services/IEventAction file to drop into the extensions folder on A9.
Add “meat’ to your PX code. Try to write the logic in a separate class so that you can “test” it from outside of A9 PX environment.
When tested, package all into single jar and drop into the extensions folder – make sure to use a slightly different package name so you know that A9 is picking up your new PX and not the old PX.
1. Use groovy script to get Parent and Child attributes and create a Script Px event handler.
2. Check your condition in Script px code and if it fails use AgileDSLException to prevent it from moving to next state.
For ex: throw new AgileDSLException (“Your Message that you want to show as a banner in agile screen when user tries to move the ECO to Submit from Pending”);
3. Use Event type ‘Change Status’ event.
4. In event subscriber set the error handling rule to ‘Stop‘ and execution mode must be in ‘Pre‘ state.