Fetching variable from js policy to assign message policy.

sumitsky7
Participant I

Hi everyone,

I am trying to get a variable value from "java script policy" to "assign message policy" and setting it there in flow variable.

java script-

var resoursepath = 'SetWorkOrderState';

context.setVariable("resoursepath", resoursepath);

assign variable policy-

<AssignVariable>

  <Name>path</Name>

  <Value><!-- what goes here? --></Value>

  </AssignVariable>

</AssignMessage>

I want to know what should sit in the value tag to fetch the variable from js policy.

Thanks in advance.

Solved Solved
0 2 1,051
1 ACCEPTED SOLUTION

Not applicable
context.setVariable("resourcepath", 
    'value-for-resourcepath-variable');

This directly sets the resourcepath flow variable to a value.

if you want to use AssignMessage to refer to that variable, you can use something like this:

<AssignMessage name='policy-name-here'>
  ...
  <AssignVariable>
    <Name>some-other-variable</Name>
    <Ref>resourcepath</Ref> <!-- refer to previously set var -->
  </AssignVariable>
</AssignMessage>

View solution in original post

2 REPLIES 2

Not applicable
context.setVariable("resourcepath", 
    'value-for-resourcepath-variable');

This directly sets the resourcepath flow variable to a value.

if you want to use AssignMessage to refer to that variable, you can use something like this:

<AssignMessage name='policy-name-here'>
  ...
  <AssignVariable>
    <Name>some-other-variable</Name>
    <Ref>resourcepath</Ref> <!-- refer to previously set var -->
  </AssignVariable>
</AssignMessage>

Thanks Priyadarshi. It helped me find my way.