Hi
@Steve Linn ,
I request your help in the below issue , Please guide me.
I am trying to set a runtime variable which I want to access in the set variable policy just after my gateway script , In my gateway script I have mentioned below code :
var originalAPIpath = "/proposalservice/v2/proposal";
var APIpath = originalAPIpath.replace("/proposalservice/v2", "");
context.set('APIpath', APIpath);
But I am getting an exception while doing this and it says in Datapower logs :
apim.gatewayscript: ReferenceError: context is not defined
Could you please let me know what I am doing wrong?
Also I will be accessing the variable APIpath in the set variable policy below , is it correct?

Thanks
Adarsh
------------------------------
Adarsh Thakur
------------------------------
Original Message:
Sent: Mon November 29, 2021 10:42 AM
From: Steve Linn
Subject: Switch condition on Context Variable
Hi Romil,
Referencing the context variable directly is all that is needed
- switch:
version: 2.0.0
title: switch
case:
- condition: (id = '2')
execute:
...
Regards,
Steve
------------------------------
Steve Linn
Senior Consulting I/T Specialist
IBM
------------------------------