1
0
-1

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?

  1. From the submissionType - saved/submitted
  2. The submissionKey is blank, (Not sure this is possible but been asked to use if so)
  3. The task key exists

 

Thank you,

  1. Miroslav Botka

    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?

  2. Kristan Elliott

    Hi, 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. Thank you,

CommentAdd your comment...

2 answers

  1.  
    2
    1
    0

    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 4.3.4.3) 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.

    1. Kristan Elliott

      Hi Miro,

      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?

      Thanks!

    CommentAdd your comment...
  2.  
    1
    0
    -1

    Hi Kristan,

    1. I think the submission object is missing when you open a fresh / new form. It should be safe to assume its not a pre-created user assigned task in this case. To avoid the groovy script exception it normally throws in this scenarios when you try to use the submission object use: 

      def currentSubmission = binding.variables.containsKey("submission") ? submission : null

    2. You can manually create the "Run On Save Resume" parameter on your prefill service (no other TM resource). However bear in mind its supported since TM 4.3.4.3 only. You are right that it might not be present on prefill services created on earlier TM versions even when the TM is already upgraded to 4.3.4.3. However it will be present on any new prefill services created in TM 4.3.4.3 (and higher version)

    Cheers

    Miro

      CommentAdd your comment...