Hi Zafiris, that's a good trick, thanks for sharing,
In my case the optional unstructured task is repeteable which make things a bit more complex as you need to be switching on and off the variable in the shared BO.
However, I still prefer a cleaner implementation using a SF. It should be possible as there is a documented JS API for that.
Does anybody knows how to use that API? why am I having unresolved references in the API?
I cannot do:
var properties = new tw.object.ActivityListProperties();
should I add any JS module as a File in order to use the API?
------------------------------
Eduardo Izquierdo Lázaro
Automation Architect
DECIDE
MADRID
+34609893677
------------------------------
Original Message:
Sent: Wed August 04, 2021 02:29 AM
From: ZAFIRIS KERAMIDAS
Subject: How to start an optional unstructured task by code using JavaScript API?
A technique I have used is leveraging the shared business object features like so:
1. The ad-hoc activity is configured to start automatically based on a precondition expression e.g. a variable (which is part of a shared business object) becomes true
2. The human task sets this variable when user clicks "Start Task". Remember to also set "Update content objects and shared business objects when saving the execution context"
------------------------------
ZAFIRIS KERAMIDAS
Original Message:
Sent: Tue August 03, 2021 12:14 PM
From: Eduardo Izquierdo Lázaro
Subject: How to start an optional unstructured task by code using JavaScript API?
Hello,
I have a process with an optional unstructured activity. I want to start this activity from another human Task of the same process by code (clicking a "Start Task" button).
I'm trying to implement in a service flow using the JS API. It seems that TWProcessInstance,taks only returns the tasks that are already active.
So I'm trying to use TWProcessInstance,retrieveActivityList(ActivityListProperties properties, Integer maxRows , Integer beginIndex , Boolean checkAuthorization)
However this API seems to be incomplete. Even when it is documented in JavaScript API available in processes and service flows it raises the following error.
ReferenceError: "ActivityListProperties" not defined.
I've tried to avoid the reference error passing a null value as parameter (to get all the activities without any filter) but it also raises an error because is expecting an object of type ActivityListProperties.
How can I do? Am I using the right API?
How can i get the tasks ready to start of a process instance and then start it?
Thanks in advance
------------------------------
Eduardo Izquierdo Lázaro
Automation Architect
DECIDE
MADRID
+34609893677
------------------------------