Retrieving mandaory attributes from a criteria in a PX

I have a workflow attached to an ECO. Within a specific status of the workflow, I would like to write a Java PX to retrieve all the mandatory attributes from all the criteria, to validate to see if there are any values missing. If a value is missing, I would like to present the user with an error and not allow the workflow approval process to take place.

Is this possible? If so, any example code would be greatly appreciated.

No Files Were Attached
wingng Agile User Asked on September 10, 2018 in Other APIs.
Add Comment
3 Answer(s)

The problem I see is if you collect all the mandatory fields from all the criteria then why have more than one criteria? I am guessing if there is more than one criteria there is a reason for that.

Steve Jones, the PLM Doctor Agile Angel Answered on September 10, 2018.

Yes, we have different criteria for users belonging to different user groups.

on September 11, 2018.
Add Comment

Hi,

Please refer to this thread having similar query:

http://myagileplm.com/questions/eco-workflows-getting-stuck-because-of-required-fields/

The sample code to retrieve mandatory fields is here as follows:

 

IWorkflow wf = (IWorkflow) session.getAdminInstance().getNode(NodeConstants.NODE_AGILE_WORKFLOWS).getChildNode(“My Sample Workflow”); 
INode child;
for(IStatus status : wf.getStates()){
              System.out.println(“For status “+status.getName());
              for(Object obj : status.getChildNodes()){
                          child = (INode)obj;
                          for(Object o : child.getChildNodes()){ 
                                  System.out.println(“For workflow status criteria: “+((INode)o).getName()+”, the exit required field is: “+((INode)o).getProperty(new                                                                    Integer(202)).getValue().toString());
                          }
              }
}

Instead of going this way, you can simply call IChange.audit() method which returns a map and then iterate through it to get your required data.

Regards,
Swagoto

Swagoto Agile Professional Answered on September 11, 2018.
Add Comment

Thank you everyone. I will use the IChange.audit() method to do the validation.

wingng Agile User Answered on September 12, 2018.
Add Comment

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.