Interested in a ServiceNow event built for developers? Registration for now[dev]26 is officially open!

How to set Http Query parameter in Rest message?

snehalmadakatti
Mega Expert

Hi Developers,

Can anyone let me know how o set the Http Query parameter dynamically?

I am just trying to use Get method to get incident details. And i am triggering this rest from below scheduled job.

Rest Outbound message:

find_real_file.png

Scheduled job: (hardcoded sysid just for testing, later will use the dynamic sysid)

find_real_file.png

Regards,

Snehal

1 ACCEPTED SOLUTION

snehalmadakatti
Mega Expert

I got it solved! 

I used setStringParameter to set the http query parameter and in http query parameter set the value as ${variablename}

find_real_file.png

find_real_file.png

Regards,

Snehal

View solution in original post

5 REPLIES 5

Ankur Bawiskar
Tera Patron

Hi,

you will have to use this function to set the query parameter

setQueryParameter()

setQueryParameter(String name, String value)

Regards
Ankur

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

Thanks for the response Ankur!

snehalmadakatti
Mega Expert

I got it solved! 

I used setStringParameter to set the http query parameter and in http query parameter set the value as ${variablename}

find_real_file.png

find_real_file.png

Regards,

Snehal

Hi,

you can use setStringParameter() with variable substitution but there is direct function for that so no need for variable substitutions

Regards
Ankur

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