I am looking for a flag in the form xml, to determine if a submission is new or it is from a previous submission for prefill service. What is the best way to tell?
Hi Kristan, do you have more details on "from a previous submission for prefill service"? Are you trying to distinguish a fresh form from
1. a resumed saved form
2. Review/Form type task
3. a task in collab job?
So we have a form that is submitted and from that submission we are creating a new task using the jobTaskAssignWebService, however we are not using the job controller. What I would like to achieve is for prefill to run on both form initialization but interrogate the form to determine if it is the new task created from the first submission. The prefill needs to behave slightly different for the second initialization.
Hi Kristan, thanks for the details in the comments.
When TM creates a user assigned task (via Admin UI, API or collab job) it will populate /AvokaSmartForm/SFMData/SystemProfile/TaskKey with the task key (likely to be equal to the submit key). You can bind a phase value in the composer/maestro form (if there isnt any) to check whether this is a task.
If you want to do this in a prefill service you can check submission.taskKey whether its/isnt empty.
In the case the prefill service is not run on your tasks (I think its omitted in some scenarios - Review tasks) you can set the "Run On Save Resume" prefill service property to "true" (since TM 22.214.171.124) which will trigger the prefill service everytime the task (or a fresh form) is open/resumed.
If you dealing with Anonymous tasks we can elaborate further as I dont think the taskKey property is going to be set at all so maybe other ways need to be analysed.
Hope this helps.
This was exactly what I needed, however I noticed two things. It appears that the submission object is not included in the prefill service even though is declared in the parameters.
Additionally, the service property you defined above, I have only seen form, client, user properties, is this a property I would create at the form level and use a parameter in my service?
def currentSubmission = binding.variables.containsKey("submission") ? submission : null