cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Need help navigating or using the PTC Community? Contact the community team. X

How to get "Synchronize" component in the workflow in the javacode

akattasubramany
1-Newbie

How to get "Synchronize" component in the workflow in the javacode

Hi,

Can any one help me in getting "Synchronize" component in javacode.

sync.png

Thanks in advance

Regards,

Archana

7 REPLIES 7

Archana,

Your question does not provide enough information about what you are trying to do.  I will say that the Help Centre covers information on using Synchronization Robots.  There are different "type" settings for these Robots that determine how the code is run.  An expression type with run the code periodically (Documentation states every couple of seconds) to evaluate if a condition has been met and proceed if true.  An Object type will "listen" to events on the Object supplied by a variable and you can choose which type of event your Robot is listening for and evaluate accordingly.  One example is listening for a State change and processing if "State A" then do this otherwise do that (result = this, result = that).  The last is Class type where the Robot listens for events emitted by all objects of a given class.

I will qualify the above with this being my understanding.  Experts - if I have misinformed please correct.

Hi Keir,

Thanks for ur information.

Let me explain u what is my requirement.

I have a requirement, where my custom java code takes an input of ChaneNotice number, and returns where it is stuck in its associated workflows.

I am able to capture in the code if it is stuck in any of the tasks ex:"Complete change Notice" or "Review ICN" and etc. But due to some issues, my CN got stuck in ESI workflow in "Post_release" Sync Robo. So i need to capture this in my java code and return to UI.

Using "WorkItem" API i am able to capture tasks of CN. In the same way I need an API which will represent this "Sync Robo" components of workflow.

Thanks in advance.

Regards

Archana

You can query sync robots in wfprocess using below API's

      

       WfProcess process=null;

      

       QuerySpec qs1 = new QuerySpec(WfSynchRobot.class);

        qs1.setAdvancedQueryEnabled(true);

        qs1.appendWhere(new SearchCondition(WfSynchRobot.class,

                WfActivity.PARENT_PROCESS_REF + "." + ObjectReference.KEY,

                SearchCondition.EQUAL, PersistenceHelper.getObjectIdentifier((Persistable)  process).getId()));

        QueryResult syncRobots = PersistenceServerHelper.manager.query(qs1);

       

  Hope It helps !!!

     

Thanks

Shreyas

Hi Shreyas,

Thanks for ur reply.

Hope u have remembered my earlier post  "workflow tasks to get in the code" for which u have provided me a solution.

In the same way, can u please let me know is there any way to find these SyncRobots using "WorkflowCommands.getRouteStatus(nmOid);"

For ur reference PFB.

WfProcess process = (WfProcess) processes.nextElement();

NmOid nmOid = new NmOid(process);

QueryResult status = WorkflowCommands.getRouteStatus(nmOid);

while(status.hasMoreElements())

{

Object obj = status.nextElement();

if(obj instanceof WorkItem)

{

WorkItem workitem = (WorkItem) obj; 

if(!(workitem.getStatus().equals(WfAssignmentState.COMPLETED)))

{

System.out.println("The ICN is stuck at "+workitem.getIdentity()+"in the"+process.getIdentity());

}

}

if(obj instanceof WfSynchRobot)

{

WfSynchRobot sync=(WfSynchRobot)obj;

System.out.println("SyncRobot"+sync.getDisplayIdentity());

}

}

But it is entering in to the second if condition , even though the ICN is stuck in the "Sync Robot" in the workflow   Please let me know if I am doing anything wrong.

Thanks in advance.

Regards,

Archana

Sorry for the typo.

It is not entering in to the below code when it is stuck at "Sync robot" in the workflow

if(obj instanceof WfSynchRobot)

{

WfSynchRobot sync=(WfSynchRobot)obj;

System.out.println("SyncRobot"+sync.getDisplayIdentity());

}

Regards,

Archana

Hi Archana,


WorkflowCommands.getRouteStatus(nmOid) will give you data which is displayed in Process Status. if you want to get another data related to process then you need to write your own query to get it. in similar way you can write query for Expression Robot.


Thanks

Shreyas

Thanks Shreyas

Top Tags