2
1
0

I have a form where at the end there are 2 possible paths a form can take. If a user selects 'pay now' then the user is taken to payment and form is finished, bypassing collaboration.

But if a user selects the 'pay later' option then the form is run through the collaboration service and a task is created that gets picked up by a user of the defined group.

I cant seem to work out how to use the conditional route name based off a selection in the form. It looks like that if i choose the 'pay now' option then payment is initiated and the collaboration service doesn't even come into play, but if i choose pay later i get an error:

Here is the code I am JSON for the job controller i am trying to work with:

{
  "jobDetails": { 
    "name": "LiquorPermit",  
    "processSubmitImmediate": "true",  
    "version": "4.0.6"
  },
  "steps": [
    {
      "name": "Application Start",
      "type": "start",
      "actions": [
        {
          "name": "Form submitted by user",
          "type": "Job Form Start",
          "properties": [
            { "name": "Process Message Send Email",  "value": "true" },
            { "name": "Process Message Text",  "value": "${submission.formName} submitted by ${submission.dataExtractMap.GivenName} ${submission.dataExtractMap.FamilyName} has been recieved." },
            { "name": "Conditional Route Name",  "value": "#if ( $submission.dataExtractMap.PaymentMethod != 'PayNowByCreditCard') Shopfront #end" }
          ]
        }
      ],
      "routes": [
        { "name": "Shopfront",  "nextStep": "Verify" },
        { "name": "Deliver",  "nextStep": "Deliver Submission" }
      ]
    },
    {
      "name": "Verify",
      "type": "",
      "actions": [
        {
          "name": "Verify",
          "type": "Job Task Assign",
          "properties": [
            { "name": "Task Assign Group",  "value": "Shopfronts" },
            { "name": "Task Email Message",  "value": "Form ready to be viewed"},
            { "name": "Task Email Subject",  "value": "${submission.dataExtractMap.TaskEmailSubject}" },
            { "name": "Task Form Code",  "value": "1083" },
            { "name": "Task Message",  "value": "${submission.dataExtractMap.TaskMessage}" },
            { "name": "Task Review Previous Step",  "value": "true" },
            { "name": "Task Send Email",  "value": "true" },
            { "name": "Task Subject",  "value": "${submission.dataExtractMap.TaskSubject}" }
          ]
        },
        {
          "name": "Review Wait",
          "type": "Job Task Wait"
        }
      ],
      "routes": [
        { "name": "Deliver",  "nextStep": "Deliver Submission" }
      ]
    },
    {
      "name": "Deliver Submission",
      "type": "",
      "actions": [
        {
          "name": "Trigger Submission Delivery Service",
          "type": "Job Delivery",
          "properties": [
            { "name": "Smartforms Delivery",  "value": "Smartforms Delivery" }
          ]
        }
      ],
      "routes": [
        { "name": "Default",  "nextStep": "Application Delivery" }
      ]
    },
    {
      "name": "Application Delivery",
      "type": "",
      "actions": [
        {
          "name": "Application Delivery",
          "type": "Job Delivery"
        },
        {
          "name": "Application Delivery Wait",
          "type": "Job Delivery Wait"
        }
      ],
      "routes": [
        { "name": "Default",  "nextStep": "Application Completed" }
      ]
    },
    {
      "name": "Application Completed",
      "type": "endpoint",
      "actions": [
        {
          "name": "Process Message",
          "type": "Job Process Message",
          "properties": [
            { "name": "Process Message Send Email",  "value": "true" },
            { "name": "Process Message Submission Step",  "value": "Application Start" },
            { "name": "Process Message Text",  "value": "Thank you  has been Approved." }
          ]
        }
      ]
    }
  ]
}

So basically i am hoping to have one option where it doesn't necessarily need to run through the collaboration (Pay now) and the other it runs through the Collaboration steps.

 

Any ideas????

    CommentAdd your comment...

    1 answer

    1.  
      2
      1
      0

      Hi Don,

      There are a couple of ways to add the functionality you described. The first would be in form, the other is how you have done it.

      Using your collaboration job as an example,

      From application start there is two routes, Shopfront and Deliver.

      Using the inform method, you can set the job route using a business rule or other field script. Simply set the route field, located Nuts & Bolts>Transaction Manager Support>CollaborationSupport>RouteName, using the code sfc.setRawValue({RouteName}, "ROUTE_NAME"). Here you can add the conditional logic to define different routes based inform values.

      The other method is using the conditional JSON as in the above question. From what i can see in your provided code it should work. However there was a bug in some older TM versions around Collaboration jobs, the work around for this was to remove the spaces in the conditional. Like this:

      #if($submission.dataExtractMap.PaymentMethod!='PayNowByCreditCard')Shopfront#{else}Deliver#end

      I also added an else clause, to replicate the desired functionality. Double check that any servies that the controller is calling are correctly named, and that the job controller services is selected in the form services tab in the form version within TM.

      If you continue to get an error you may need to raise a support ticket with some additional information about the collaboration Job.

      Josh

      1. Don Sibley

        Thanks Josh, I was able to get this working by adding some logic in the form as you pointed out. Based off selections in the form the job will go to delivery or go and and get task created. Thank you for your help!

      2. Joshua Miller

        You can find some more information in the following knowledge base article, https://support.avoka.com/kb/display/AT43/Composer. Including setting the route value.

      CommentAdd your comment...