Getting "undefined" value from REST Outbound Message

NehaSNOW
Tera Guru

Hi Members,

 

I am getting the "undefined" values from the Query Parameter of the REST Outbound message (refer the screenshot). But when the Parameter values are passed from the Endpoint then they are received properly e.g. https://<instanceid>service-now.com/api/918167/incident/create_incident?correlationid=${corrid}&shortdescription='${shortdesc}'.

Please suggest.

Release: Xanadu

 

The Scripted REST API is: - 

NehaSNOW_0-1739019002898.png

 

Query Parameter of the REST Outbound Message POST: -

NehaSNOW_1-1739019089918.png

 

Logs: - 

NehaSNOW_2-1739019136163.png

 

 

 

1 ACCEPTED SOLUTION

NehaSNOW
Tera Guru

I have fixed it by myself.

View solution in original post

11 REPLIES 11

Natan F Rosa
Kilo Guru

Hi @NehaSNOW 
I think maybe I'm getting the structure wrong. To see what the structure is like you can try printing the "request" object using JSON.stringify()

If you found my answer helpful, please like and mark it as an "accepted solution". It helps future readers to locate the solution easily and supports the community!

Tks
Natan Felipe

Hi @Natan F Rosa 

 

I have entered gs.log('TESTING Request: '+ JSON.stringify(request.body)); in the Scripted REST API and it is showing blank in the logs (screenshot). Please suggest.

NehaSNOW_0-1739029936669.png

 

@NehaSNOW 
Just try gs.log('TESTING Request: '+ JSON.stringify(request)); to see what happens.

@Natan F Rosa  It is same i.e. blank (screenshot of logs). By the way I have passed the hardcoded values also in the Query Parameter but still the request is showing as blank in the Log. I believe either it could be an issue with the request in the Query Parameter or in the Scripted REST API with the way it is receiving the request screenshot attached).

 

Logs:-

NehaSNOW_0-1739030779751.png

 

Scripted REST API: -

NehaSNOW_1-1739031009254.png