Page 1 of 1

Workflow

PostPosted: Mon Aug 12, 2019 5:29 pm
by lucdep
Hi,

I'm looking around in Workflow

In my project approval workflow I want to introduce an approval screen, so I first create a ToDo and then when the user having the ToDo clicks on Action in his ToDo list, I want to a popup window to open where the user can review and approve. But I'm not shure how to open a popup window from the Workflow. I guess I'll have to create a custom function in .java file and then have a Client Call to that function, but it is not clear to me how this function should look like and where in the app directory I must put this .java file?

Regards

Luc

Re: Workflow

PostPosted: Tue Aug 13, 2019 9:40 am
by Support@SIB
Not sure, what you exactly want:

Your workflow inserts/updates a todo in your custom table?
1) The user logs in and should get a popup with information about a new record/state and with a Button to do something?
1.1) The user is already logged in and the same popup should be opened?

2) The user logs in and nothing will happen until a specific work-screen will be opened. The work-screen shows that something happened and has some buttons to start different actions?
2.1) The user is already logged in and nothinw will happen until he opens the work-screen?


Did you check our built-in ToDo functionality? WF engine comes with a todo extension... It's easy to add some columns to the used table.

Re: Workflow

PostPosted: Tue Aug 13, 2019 11:07 am
by Support@SIB
You could use the function: Client call

If you leave the username blank, all clients will execute the call.

The call is done on application context, so if you call a method which is available in your application, it will be called, e.g.

Code: Select all
public void checkApproval()

In this method you can do whatever you want. It's a good idea to call this method in afterLogin().

It's also possible to create a work-screen without menu entry. You can open this work-screen via work-flow client call and also set this work-screen as welcome screen. The screen could check the current state and close immediately or stay open....

How to create a custom application?
Check the doc, e.g. Replace error dialog, Customize the application frame

Re: Workflow

PostPosted: Tue Aug 13, 2019 7:27 pm
by lucdep
Hi,

Thanks for

I created following method in TodoWorkScreen.java:

Code: Select all
public void checkApproval(String sID) throws Throwable
   {
      HashMap<String, Object> htParam = new HashMap<String, Object>();
      htParam.put("lookupid", new BigDecimal(sID));
      getApplication().openWorkScreen("com.sibvisions.apps.wftest.screens.ApproveWorkScreen", Modality.Modal, htParam);
   }


which I invoke in a "Client Call" step coming right after a "Wait for Todo" step

Code: Select all
checkApproval("[PROJ_ID]")


giving me this error:
Code: Select all
java.lang.NoSuchMethodException: com.sibvisions.apps.projx.ProjX.checkApproval(java.lang.String)
   at com.sibvisions.util.Reflective.call(Reflective.java:268)
   at com.sibvisions.util.SimpleJavaSource.parseCallOrField(SimpleJavaSource.java:1755)
   at com.sibvisions.util.SimpleJavaSource.parseCallsOrFields(SimpleJavaSource.java:1725)
   at com.sibvisions.util.SimpleJavaSource.parseParameter(SimpleJavaSource.java:1312)
   at com.sibvisions.util.SimpleJavaSource.parseParameterWithOperators(SimpleJavaSource.java:1356)
   at com.sibvisions.util.SimpleJavaSource.execute(SimpleJavaSource.java:585)
   at com.sibvisions.apps.workflowengine.Workflow.executeClientCall(Workflow.java:285)
   at com.sibvisions.apps.workflowengine.Workflow$1.callBackResult(Workflow.java:71)
   at javax.rad.remote.event.CallBackResultForward$1.run(CallBackResultForward.java:93)
   at java.desktop/java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:313)
   at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:770)
   at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:721)
   at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:715)
   at java.base/java.security.AccessController.doPrivileged(AccessController.java:389)
   at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:85)
   at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:740)
   at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:203)
   at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:124)
   at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:113)
   at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:109)
   at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
   at java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:90)



What is going wrong?

Luc

Re: Workflow

PostPosted: Wed Aug 14, 2019 1:09 pm
by Support@SIB
Everything is right and the previous post contained:

The call is done on application context, so if you call a method which is available in your application, it will be called, e.g.

So, simply create your own application class.

Sure, it's possible to use the method in your screen, but I guess your approval check should also work if screen isn't open?

This should work with your current test:

Code: Select all
openWorkScreen("your.package.TodoWorkScreen").checkApproval("[PROJ_ID]")

Re: Workflow

PostPosted: Wed Aug 14, 2019 1:51 pm
by Support@SIB
Instead of the HashMap parameter, it's supported to use: new Parameter("lookupid", new BigDecimal(sID))

Re: Workflow

PostPosted: Mon Aug 19, 2019 1:55 pm
by lucdep
Hi,

It works now, thanks!

Can the the Parameter method be used when more than 1 parameter have to be given through? How does it go?

Regards,

Luc

Re: Workflow

PostPosted: Tue Aug 20, 2019 7:12 am
by Support@SIB
The parameter is defined as Parameter... so it is easy to use multiple Parameter instances.

Re: Workflow

PostPosted: Wed Aug 21, 2019 8:07 am
by Support@SIB