- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-29-2024 01:03 AM
Hello,
I have been trying to create a GlideRecord request to a data set in a script action. But I cant call the values of different fields in the data set through dot walking, even though I can call the sys id of the data set.
And when I run the code as a Background script it works just fine... Any idea why it doesnt work as a script action? Thanks!
My Code:
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-29-2024 02:23 AM
On this table of yours - do you have any query business rule running ?
Maybe try:
var request_id = event.parm2 //this is the sys_id I want to call
var data_set = new GlideRecord("table_name");
data_set.setWorkflow(false); //Disables query business rules that could prevent the user from seing the record
if (data_set.get(request_id)) {
gs.info("test Number: " + data_set.getValue("number"));
// Get Value function returns "null". (Not if I run this exact code as Background Script)
} else {
gs.info("Record not found");
}I dont know if the table is in global scope, scoped app, or something similar (domain separation) that could also cause issues.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-29-2024 02:08 AM
Can you send the exact code you are using?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-29-2024 02:16 AM
var request_id = 'insert_sys_id'; // I'm not allowed to share any kind of company info pls replace it with a sys_id
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-29-2024 02:17 AM
I actually had
data_set.getValue("number");
instead of getDisplayValue