Skip to main content
Kinetic Community

Passing Results back to a Deferred Node from Another Task Tree

How to pass information from one task tree to another.


The most common example of this technique is to pass information from an approval task tree to the original requesters task tree. The approver may have to answer more questions than just the approved/denied question, and these other answers could be factors in which branch the original task tree uses.

The place to put your extra information is in the results parameter of the Create Trigger node. Normally, the results parameter is just used to pass the Validation Status - used to track approved /denied status. You can use the same syntax to add your own values (normally answers) to pass back to another task tree.


Results Parameter

Here is what the syntax looks like when you pass a validation status back to an approval node.


     <result name='Validation Status'><%=@answers['Approval Question']%></result>

If you want to add more answers (or any other values) to send to the other task tree as results, you use the same format.

For example, you want to add the answer to the question "Group Assigned" - here is the format:

   <result name='Group Assigned'><%=@answers['Group Assigned']%></result>

You decide on the name. It doesn't have to be the same as the question (although many customers stick to that convention), it just has to be something that you will remember. 

For answers to questions, the value in the square brackets needs to be the Menu Label of the question. 

Adding the two lines together you will get something like this:

     <result name='Validation Status'><%=@answers['Approval Question']%></result>
     <result name='Group Assigned'><%=@answers['Group Assigned']%></result>

Using the Result

To use the result in another task tree, you need to know two things, the node that received the result, and the name of the result. Here is the syntax for using the validation status:

@results['Create Approval']['Validation Status']

the @results means it is a result of, or result passed to a node in the task (you can have results from nodes within the same tree - different community article). The next value in square brackets defines the name of the node that the result is from. The last value in square brackets is the name of the value.

If you wanted to use the result that we defined for Group Assigned above, from the Create Approval node, it would look like this:

@results['Create Approval']['Group Assigned']

One other thing to be aware of is that results that you define will not necessarily be available in the Pre-defined values drop-down list. The only values that are shown there are the ones defined when the Task handler was created - they are values defined in the node.xml. You will have to hand type any results that you create and pass for your own nodes. Although, most customers simple find a result with the same node name, and simple replace the result name with the name that they are using.

Usage Example

One of the most common  answers to pass back from an approval is the Reason for Denial, or some other approver comments field. In this example our field has the menu label 'Denial Reason'.

Here is the code for the results parameter on the create trigger node:

     <result name='Validation Status'><%=@answers['Approval Question']%></result>
     <result name='Denial Reason'><%=@answers['Denial Reason']%></result>
I chose to keep the name parameter of the result, the same as the menu label.
Now I want to use the Denial Reason answer in an email to the original requester if his request is denied. The body of the message would include something like this if the node that the result was passed to was named 'Create Level 1 Approval'.
<br />
Reason for denial is listed as:
<%=@results['Create Level 1 Approval']['Denial Reason']%>