POST method in outbound REST message
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-24-2019 12:14 AM
Hi All,
Can we define HTTP query parameters of post method (defined in outbound REST message) using any script?
My doubt is- here in script I am setting the parameters but there is a possibility there might be no value passed for any one of them (suppose field 'memory').
In that case when no value is there for memory, entire field/key named 'memory' should not be there in the content Shared above. The case SHOULD NOT be like "memory":' '. Rather there should be no memory at all.
TIA,
-Ruchi

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-24-2019 12:26 AM
you can pass it in your endpoint and then in your script pass it like below code.
Example:
http://abc/Test-abc/Test('${input}')
var rm= new sn_ws.RESTMessageV2('<Rest message name>', '<Rest message function name>');
rm.setStringParameter('input','check');
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-24-2019 12:45 AM
Hi Harshvardhan,
Thanks for the response!
I would like to re-frame my question.
The example given above is already used in workflow .PFA the screenshot.
My doubt is- here in script I am setting the parameters but there is a possibility there might be no value passed for any one of them (suppose field 'memory').
In that case when no value is there for memory, entire field/key named 'memory' should not be there in the content Shared above. The case SHOULD NOT be like "memory":' '. Rather there should be no memory at all.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-24-2019 01:09 AM
you can add this logic in your script it self to validate if the variables has some value or not and based on that you can pass it in setStringParameterNoEscape().
example:
var bl ;
var mem = current.variables.var_memory;
if(mem != '')
bl+= current.variables.var_memory;
var rm= new sn_ws.RESTMessageV2('<Rest message name>', '<Rest message function name>');
rm.setStringParameterNoEscape('memory',bl);
I have one question here, what will happen, if you send the blank value ? may i know your business need.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-24-2019 12:41 AM
adding one thread here, which will give you one example.. give a try and let me know if you have any further question on it.