- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-30-2017 05:08 AM
Hello.
I have a business rule that send data to the endpoint.
Here's my configuration:
Sure, I have my own Endpoint name and method name.
Here's data that I created via REST API Explorer:
And here's what I've got on the endpoint:
As you can see, all the fields are empty. The only thing I have is something like sys_package. It's the same all the time.
It looks like it just lets me know that I have create a record, but it doesn't send any details about this record in this table.
So, what I have to do to achieve data?
P.S.
I'm not sure about is it OK to post some IDs here, so don't try to hack me or something.
Solved! Go to Solution.
- Labels:
-
Integrations
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-30-2017 06:45 AM
The issue is with JSON.stringify. It does not generate what you are expecting, simply stating, you can not use that method to turn a GlideRecord into a JSON object with all the values.
You'll need to find some other method, such as looping through all of the elements and adding them as properties to a new object, and then turning it into JSON.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-30-2017 05:13 AM
Hi Kasianenko,
current is an object in business rule script. So you cannot send it directly.
Can you explain what exactly is needed i.e. endpoint and what all information you need to send. whether it is soap based or rest based endpoint.
Mark Correct if this solves your issue and also hit Like and Helpful if you find my response worthy based on the impact.
Thanks
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-30-2017 05:17 AM
I have a table called 'ticket'. When record created/updated, I need to send all the fields to the endpoint. Currently, all the fields are sent, but these fields has no data inside.
Endpoint is REST based. I have configured POST method. And I can confirm that I can intercept incoming messages from the ServiceNow inside my endpoint's backend.
`current` variable represents my `ticket` table row. It just doesn't has data inside. And it's strange, because I have selected "after" and "Insert".
I also tried with "after" and "Update", still no data.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-30-2017 05:17 AM
Hello
On which table are you running this BR?
Did you try to test this using POSTMAN to send data to the endpoint?
Check Generate a REST message script preview for more information on how rest V2 API works
Reference:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-30-2017 05:20 AM
Table `ticket`.
Yes, POSTMAN can send data to endpoint. ServiceNow can send data to enpoint. I can receive JSON from both.
I guess, the problem under `current` variable or in the configuration.
I don't have issues with sending data.