How to use a dynamic URL in a Json Call in a component

  • 21 February 2024
  • 1 reply
  • 50 views

Userlevel 3
Badge +1

I am still building our solution to automatically create ServiceNow incidents for data quality issues. After creating an incident in ServiceNow you get a JSON body as response with a link to that incident. I want to store this link in a database and later check if the incident is still active.

The URL looks like this;

https://mydev.service-now.com/api/now/table/incident/a1b02c3456d78e9012f34g56h78i90jk

In my environment I have a generic server with the url https://mydev.service-now.com/, Now all we have to do, is add the second part dynamically and feed that to the Json Call step.

My simple component to experiment with this looks like this:

 

For now I'm just going to put the second part of the url in an Alter Format step:

 

I believe I read somewhere that record_link must be mapped as a parameter for this to work. Only if you want to enter it as a value whenever you run the component or if you want to pass a parameter from a workflow. But that's not in my plans currently. So I won't map it as a parameter.

My Json Call is very simple. At least the generic stuff is.

The most important thing here, is the percent signs around my record_link column. Normally you would pass a column on with # signs before and after it. But not in case of an url. Check the advanced settings under Templates:

At first I was using the regular # signs. If you'll see is that your component run fails with this message:

[FATAL]    Call failed for record number 1 (numbered from 1)[STEP Json Call[Json Call]]

Also, and that confused me at first, the Json Call won't write the debug files you can define under Advanced settings.

 

Let's not forget the JSON data I get back from this Json Call. I want to use this in later versions. ServiceNow has a lot of attributes to share. Here I define my reader to read a list of them.

 


1 reply

Userlevel 6
Badge +7

Hi @Marcel-Jan thank you for sharing your tips with our community!

Reply