Encoding a single variable to UTF-8

Jesse St_ John
Kilo Explorer

Hi, I am trying to encode a single variable in the middle of a string that is part of an outbound HTTP Post request. The value field should accept a regular string and then encode the string to UTF-8 before sending out. Any ideas? I'm new to Service Now.

4 REPLIES 4

Ankur Bawiskar
Tera Patron
Tera Patron

Hi John,



Can you explain your detailed requirement?


I think you are consuming some endpoint either SOAP or REST based and have question in that.



Regards


Ankur


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

Jesse St_ John
Kilo Explorer

Hi Ankur,



Thank you for replying. My company uploaded a bunch of locations via an excel file to the cmd_location table, however, they are only addresses and do not have latitude and longitude with them. My end goal is to have a business rule or something that will run once a day, and if the latitude and longitude fields are empty on the location in the locations table list, then it will grab the address from the address field make an HTTP request to Google Maps API which will return a JSON object containing all the information for that location. At that point, I will grab the lat and lng and update the location entry filling in the two empty latitude and longitude fields.



I created an outbound HTTP request, but was having an issue because the address needs to be sent in UTF-8 encoding. I was able to find out that, when you pass a string off the base URL via a parameter, it encodes it for you, so I now have a variable that is being sent in UTF-8 encoding. I no longer need to know how to do encode that variable which was my original question. But if you know how, can you tell me how to access the custom Outbound REST Request I made and pass and address off to that variable via a business rule on the location table?



Thank you,


Jesse


Community Alums
Not applicable

Hi Jesse,

Where you able to solve the issue?

 

Regards

Gautham

S_ndor Seres
Tera Contributor

Hi Jesse,

You have to setup your HTTP request header with a new parameter.

Value can be: application/json;charset=utf-8 or application/xml;charset=utf-8

find_real_file.png