- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-23-2023 11:54 AM
Hello all! Is there any method to call a DataBrokerScript. Running this script from UIBuilder Client Script after capturing desired data.
function handler({api, event, helpers, imports}) { var itemSelected = event.payload.value; // Trying to call the Data Broker script and pass the itemSelected as a parameter over here: api.someMethodToCallDataBrokerScript('DataBrokerScriptName', { itemSelected: itemSelected }); }
Or should create a GlideAjax instance, targeting the server-side script.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-28-2023 05:40 AM
Hi Eberteo,
With the current screenshots, I am struggling to debug the issue.
Sure, let's get on a call to discuss this.
Do reach out to me at hasan.bilgrami@servicenow.com, and lets set something up.
Best
Hasan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-25-2023 04:51 AM
Hi eberteo,
There are 2 functions for you to use:
api - api.data.<data_resource_id>.execute(Object inputValues) if mutates data server is checked
api - api.data.<data_resource_id>.refresh() if mutates data server is unchecked
Note: You'll need to add the data broker to the data resources list of the experience
Best
Hasan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-26-2023 05:26 PM
function handler({api, event, helpers, imports}) { var dataSelected = event.payload.value[0]; console.log("Item Selected is:", dataSelected); api.data.programprofiles_2.execute({ name: dataSelected }); }
Therefore having the number selected, I went to my Data Broker and start debugging to visualize if I was receiving the input value from there. I noticed the debugger is indeed being executed every time is triggered which makes me think api.data.programprofiles_2.execute does work however as in the picture attached I'm not able to visualize the dataSelected being received in the input. Currently my Data Broker has no Properties set and the Mutates server data is checked.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-26-2023 05:27 PM
function handler({api, event, helpers, imports}) { var dataSelected = event.payload.value[0]; console.log("Item Selected is:", dataSelected); api.data.programprofiles_2.execute({ name: dataSelected }); }
Therefore having the number selected, I went to my Data Broker and start debugging to visualize if I was receiving the input value from there. I noticed the debugger is indeed being executed every time is triggered which makes me think api.data.programprofiles_2.execute does work however as in the picture attached I'm not able to visualize the dataSelected being received in the input. Currently my Data Broker has no Properties set and the Mutates server data is checked.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-26-2023 06:06 PM
Hi Eberteo,
I think I've got the issue, you need to enter properties to read the name field in the data broker.
Add a property object in the properties field like:
[
{
"name":"name",
"label":"Name",
"description":"Enter he item name",
"readOnly":"false",
"fieldType":"integer",
"mandatory":true,
"defaultValue":""
}
]
You will then be able to access the selected item using input.name
Hope this helps! If not, do revert, if possible with the data broker's screenshot, so that we can examine that and resolve this issue.
Best
Hasan