Updating HR profile value
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-27-2025 10:48 PM
Hi All,
I have a requirement for adding 'User HR profile' value in Associated Allgetaion table.
So i have created a custom field on 'Associated Allegations' table called USER HR PROFILE which is a reference field referring to user HR profile table. I am trying to populate the value on this field based on the 'Subjects of Allegation' field value. So to achieve this i have configured the below business rule.
When : Before -Update
Can anyone suggest.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-28-2025 04:40 AM
update as this
I assume field "u_user_hr_profile" refers to HR Profile table
var prof = current.involved_party;
gs.addInfoMessage("value of subject of allegation" + prof);
var hrProf = new GlideRecord('sn_hr_core_profile');
hrProf.addEncodedQuery('user=' + prof);
hrProf.query();
if (hrProf.next()) {
gs.addInfoMessage("value of subject of allegation inside loop" + hrProf.user);
current.setValue('u_user_hr_profile', hrProf.getUniqueValue());
current.update();
}
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-28-2025 07:55 PM
Hope you are doing good.
Did my reply answer your question?
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-28-2025 08:02 PM
Hi @Ankur Bawiskar ,
No the above script is not working.
It seems that script is not entering the if condition as i am not getting the info message inside the script.
Yes "u_user_hr_profile" refers to HR Profile table.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-28-2025 08:14 PM
the field "involved_party" is referring to sys_user?
If yes then did you check if any HR profile is present for that user? then only it will enter IF
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader