Cannot pass value from inputs to setStringParameterNoEscape

Tim Wicke
Mega Guru

  I have a requirement to use Outbound REST Message.  From my Flow I pass the Name of a Reference field to the Inputs of the action.  All but one Input Variable passes correctly.  The one with the issue is called vendor_agency1

 

  I set the input variable via assignment in the main Flow using data pill.  However, no matter how I populate vendor_agency1, it does not pass correctly. via the setStringParameterNoEscape method. 

 The only version that works is inline like so:

r.setStringParameterNoEscape('vendoragency', 'Microsoft'));

 

 

My script
var r= new sn_ws.RESTMessageV2('ContractorOnboarding', 'POST');
    r.setStringParameterNoEscape('number', inputs.number);
    r.setStringParameterNoEscape('firstName', inputs.firstName);
    r.setStringParameterNoEscape('lastName', inputs.lastName);
    r.setStringParameterNoEscape('vendoragency', inputs.vendor_agency1);
    r.setStringParameterNoEscape('department', inputs.department);
    r.setStringParameterNoEscape('manageremployeenumber', inputs.manageremployeenumber);
    r.setStringParameterNoEscape('mailstop', inputs.mailstop);
 
Any assistance getting this figured out is greatly appreciated.
1 ACCEPTED SOLUTION

Fixed in the most round about method

 

var vendor = inputs.vendoragency
var r= new sn_ws.RESTMessageV2('ContractorOnboarding', 'POST');
r.setStringParameterNoEscape('vendoragency', vendor);

View solution in original post

4 REPLIES 4

Ankur Bawiskar
Tera Patron
Tera Patron

@Tim Wicke 

so your subflow has inputs.

what's the input type for vendor agency? is the input variable name correct

Share screenshots

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Ankur,

    Here is the Execution from the flow:

 TimWicke_0-1741605258767.png 

TimWicke_1-1741605286006.png

Here is the input at the receiving API:

TimWicke_2-1741605403694.png

 

 

Fixed in the most round about method

 

var vendor = inputs.vendoragency
var r= new sn_ws.RESTMessageV2('ContractorOnboarding', 'POST');
r.setStringParameterNoEscape('vendoragency', vendor);

So I found one error I had a different variable name than what I had in my script.   I reset it so that the variables matched up and still the same result.

My script now reads:

var r= new sn_ws.RESTMessageV2('ContractorOnboarding''POST');
    r.setStringParameterNoEscape('number', inputs.number);
    r.setStringParameterNoEscape('firstName', inputs.firstName);
    r.setStringParameterNoEscape('lastName', inputs.lastName);
    r.setStringParameterNoEscape('vendoragency', inputs.vendoragency);
    r.setStringParameterNoEscape('department', inputs.department);
    r.setStringParameterNoEscape('manageremployeenumber', inputs.manageremployeenumber);
    r.setStringParameterNoEscape('mailstop', inputs.mailstop);