Help with getting details from HR profile on catalog item
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā09-03-2020 02:16 PM
Kia ora,
I have a record producer and want to populate a variable (hire_date) with employment_start_date from the employee profile of the signed in user when the form loads.
I've tried a few methods but can't quite get it to work and would really appreciate any suggestions š
This is what I was hoping would work but didn't:
var profile = new GlideRecord("hr_profile");
profile.addQuery("user",g_form.getValue("opened_for"));
profile.query();
if(profile.next())
g_form.setValue('hire_date',profile.employment_start_date);
Thanks,
Brett
- Labels:
-
HR Service Delivery

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā09-03-2020 02:23 PM
Can you try below.
var profile = new GlideRecord("sn_hr_core_profile");
profile.addQuery("user",g_form.getValue("opened_for"));
profile.query();
if(profile.next())
g_form.setValue('hire_date',profile.employment_start_date);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā09-03-2020 03:14 PM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā09-03-2020 04:03 PM
Hi Brett,
I'm not sure with what role you are testing this record producer, but I suspect that the user you are using does not have the minimum role required to read the HR Profile table and that's the reason it's not returning the desired field value with the script.
Minimum role required to read the data of HR Profile is hr_reader, could you please give a try impersonating any user with HR role and test, I believe it will work.
Regards,
Alok
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā09-03-2020 04:22 PM
Thanks for the suggestion Alok.
I am the one completing the form and have sn_hr_core_profile.writer role so it should work?
Your reply is still really helpful though, because if that permission is required for this type of script to work then my solution wouldn't work for every day users because they do not have the permission.
Thanks again.
- B