Business Rule `current` has no data

vladk
Giga Contributor

Hello.

I have a business rule that send data to the endpoint.

Here's my configuration:

1.PNG

2.PNG

3.PNG

Sure, I have my own Endpoint name and method name.

Here's data that I created via REST API Explorer:

4.PNG

And here's what I've got on the endpoint:

5.PNG

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.

1 ACCEPTED SOLUTION

Chris M3
Tera Guru

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.


View solution in original post

7 REPLIES 7

Ankur Bawiskar
Tera Patron
Tera Patron

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


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

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.


dravvyramlochun
ServiceNow Employee
ServiceNow Employee

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:


RESTMessageV2


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.