Server-side functions in UI Builder - has this guidance changed?

thomaskennedy
Tera Guru

I need to raise an event from a UI Builder page, so as to run a background process. This thread says:

 

Any data handling in UIB, whether pulling data or writing data, should be handled through data resources. There are update record and create record data resources you can use for simple updates, or you can create your own GraphQL or REST data resources. The last resort would be to create a transform data resource to execute some server side code.

 

https://www.servicenow.com/community/developer-forum/server-side-calls-in-ui-builder-handler-functio...

 

So that's what I did, I put a transform data resource on the page, and all it does is:

function transform(input) {
	gs.eventQueue("my.event.name", null);
}

That thread was two years ago; has anyone found a simpler method?

1 REPLY 1

Diogo Ramos
Giga Sage

From my understanding that is still the simplest way to execute server side code yes.

Ideally you create it in a generic way so your can pass the event name as an input when you configure your data resource in your ui builder page, and then you use the input on your code. (Don't forget to create a ACL for your data broker).

You could have other options like a rest api for example , but that involves creating more artifacts then this approach. 

Cheers