- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-05-2023 10:08 PM - edited 10-05-2023 10:08 PM
Hi All,
I have a requirement of creating a HR case in which the after selecting subject person it should show whether use having HR profile or not.
Can anyone help me with the script.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-05-2023 10:35 PM
Hello @shadoworg
Second Solution is that You can add reference Qualifier for that field.
Right Click on the Field> Configure Dictionary > Go to Related Tabs > Reference Specification > Choose Advanced.
Write the Calling of script include :-
javascript: new checkHRProfile().checkHRProfile();
Script Include code should be like :-
var gr = new GlideRecord('sn_hr_core_hr_profile');
gr.query();
while(gr.next()){
return gr.sys_id;
}
Plz mark my solution as Accept, If you find it helpful.
Regards,
Samaksh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-05-2023 10:16 PM
Hello @shadoworg
You need to write a onChange Client Script for that :-
var gr = new GlideRecord('sn_hr_core_hr_profile');
var sysId = g_form.getValue('subject_person');
gr.get(sysId);
if(!gr.next()){
alert('your msg');
return false;
}
Plz mark my solution as Accept, If you find it helpful.
Regards,
Samaksh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-05-2023 10:26 PM
1. Write an on change client script on subject person.
2. You cannot glide a table directly in client script so you will have to use glide ajax to check if the HR profile exists.
3. If it does not exist you can return false from your script include and pop up an alert accordingly.
Refer :https://developer.servicenow.com/dev.do#!/reference/api/utah/client/c_GlideAjaxAPI for glideajax examples.
Please mark the answer correct/helpful accordingly.
Raghav
MVP 2023
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-05-2023 10:35 PM
Hello @shadoworg
Second Solution is that You can add reference Qualifier for that field.
Right Click on the Field> Configure Dictionary > Go to Related Tabs > Reference Specification > Choose Advanced.
Write the Calling of script include :-
javascript: new checkHRProfile().checkHRProfile();
Script Include code should be like :-
var gr = new GlideRecord('sn_hr_core_hr_profile');
gr.query();
while(gr.next()){
return gr.sys_id;
}
Plz mark my solution as Accept, If you find it helpful.
Regards,
Samaksh