- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-10-2018 03:16 PM
this is my work dev instance, and here is the script I'm and trying to run
function QueryUAT()
{
var gr = new GlideRecord('u_user_access_list');
gr.addQuery('u_user', 'bdb4e9601341b2006bda75c36144b062');
gr.addQuery('active', true);
gr.query();
while(gr.next())
{
uat_software_string += gr.u_service + ',';
uat_software_string_display += gr.u_service.getDisplayValue() + ',';
}
uat_software_array = uat_software_string.split(',');
uat_software_array.length --;
uat_software_array_display = uat_software_string_display.split(',');
uat_software_array_display.length --;
gs.addInfoMessage("Current Software - " + uat_software_array_display.toString());
}
output for current software is nothing, when running it from employee history application, when I run it on global I get the output of one application (which is all it should have) of Slack.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-10-2018 03:17 PM
here is the whole script if you need that
var user = '581949a4136f4b80ce8b7d576144b08d';
var arrayUtil = new global.ArrayUtil();
var uat_software_array = [];
var uat_software_array_display = [];
var new_job_title_software_array = [];
var new_job_title_software_array_display = [];
var add_add_gen_access_array = [];
var remove_add_gen_access_array = [];
var add_add_gen_access_array_display = [];
var remove_add_gen_access_array_display = [];
var new_job_title_software_string = "";
var uat_software_string = "";
var uat_software_string_display = "";
var new_job_title_software_string_display = "";
var counter = 0;
function QueryUAT()
{
var gr = new GlideRecord('u_user_access_list');
gr.addQuery('u_user', 'bdb4e9601341b2006bda75c36144b062');
gr.addQuery('active', true);
gr.query();
while(gr.next())
{
uat_software_string += gr.u_service + ',';
uat_software_string_display += gr.u_service.getDisplayValue() + ',';
}
uat_software_array = uat_software_string.split(',');
uat_software_array.length --;
uat_software_array_display = uat_software_string_display.split(',');
uat_software_array_display.length --;
gs.addInfoMessage("Current Software - " + uat_software_array_display.toString());
}
function QueryNewJobTitle()
{
var gr = new GlideRecord('x_prole_emp_onb_employee_onboarding');
gr.addQuery('u_job_title', 'e9885e5113268bc08242335fd144b0f7');
gr.addQuery('u_list_location', 'Draper Headquarters');
gr.query();
while(gr.next())
{
new_job_title_software_string += gr.u_add_gen_access + ',';
new_job_title_software_string_display += gr.u_add_gen_access.getDisplayValue() + ',';
}
new_job_title_software_array = new_job_title_software_string.split(',');
new_job_title_software_array.length --;
new_job_title_software_array_display = new_job_title_software_string_display.split(',');
new_job_title_software_array_display.length --;
gs.addInfoMessage("New Software - " + new_job_title_software_array_display.toString());
}
function ArrayDiff()
{
add_add_gen_access_array = arrayUtil.diff(new_job_title_software_array, uat_software_array);
add_add_gen_access_array_display = arrayUtil.diff(new_job_title_software_array_display, uat_software_array_display);
remove_add_gen_access_array = arrayUtil.diff(uat_software_array, new_job_title_software_array);
remove_add_gen_access_array_display = arrayUtil.diff(uat_software_array_display, new_job_title_software_array_display);
gs.addInfoMessage("Add This - " + add_add_gen_access_array_display.toString());
gs.addInfoMessage("Remove This - " + remove_add_gen_access_array_display.toString());
gs.addInfoMessage('Remove Length - ' + remove_add_gen_access_array.length);
}
QueryUAT();
QueryNewJobTitle();
ArrayDiff();
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-10-2018 03:21 PM
To confirm whether you are able to access the custom global table via the scoped app or not. You can follow the below steps.
1. Navigate to background-scripts and execute the below script.
var gr = new GlideRecord('u_user_access_list');
gr.addQuery('u_user', 'bdb4e9601341b2006bda75c36144b062');
gr.addQuery('active', true);
gr.query();
while(gr.next())
{
gs.info(gr.getRowCount());
}
NOTE: Make sure to select the correct scope before triggering this script.
Thanks,
Pradeep Sharma
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-10-2018 03:29 PM
thanks for pointing me in the right direction, it wasn't working because 'active' should have been 'u_active'. F!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-10-2018 04:05 PM
You are very welcome Kazidon. I'm glad your issue is resolved now.
Thanks for participating in the community!
-Pradeep Sharma