Hello,
I have a rest message which I would like to call it in a script, but I wanna know how can I pass the string parameters dynamically in the script…?
I tried…
var r= new sn_ws.RESTMessageV2('x_sixgi_cybersixgi.Cybersixgill Actionable alerts', 'Access Token');
r.setStringParameterNoEscape('client_secret', current.client_secret);
r.setStringParameterNoEscape('client_id', current.client_id);
but this approach did not work
Please be sure to format your code as code. Makes it much easier to read and therefore to help.
You’re passing an object into those parameters. You should use getters to retrieve the values. Check out https://pbr.snc.guru for more info on how and why.
Also be sure not to use example variable names like r
in production code.
Is it’s business rule you’re calling this in?
Let us know if the above works for you. If not, please let us know what happens instead, and if any errors are logged.
I’m calling this REST message in Scheduled Jobs.
Gotcha - are you triggering the scheduled job from an event? Are you sure that the current object is being passed to the event correctly as the first parameter? Have you tried logging the data you’re attempting to access to make sure that it is actually there? Try making the changes I mentioned regarding getters and setters and your else condition block, and then let me know if that sorts you out. If not, long the data and let me know what comes back.