How to print Policy Name which is executed using JavaScript

For sample flow below

<Request>
	<Step>
		<Name>Assign-Message-Send-Request</Name>
	</Step>
	<Step>
		<Name>JS-Print</Name>
	</Step>	
</Request>

In script of JS-Print, I would like to print the policy name “Assign-Message-Send-Request”

Can I reference from apigee variable flow like context.getVariable(“apigeeVarName”) ? and what is that name ?

Hi @pimonnat , I noticed your question hasn’t been answered yet. Don’t worry—we’ll keep an eye on it and try to get some input from other members soon.

Hello @pimonnat ,

I’d create a variable in the previous step (Assign Message Policy) and then I’ll reference the variable in the Javascript policy, as per the example below:

<AssignMessage name="AM-SetPolicyName">
 <AssignVariable>
   <Name>policyName</Name>
   <Value>Assign-Message-Send-Request</Value>
 </AssignVariable>
</AssignMessage>

In this way, the variable name would be PolicyName. Additionally, depending on the use case, it could be created the properties object where javascript code can access to read custom values.

Thank you!