- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-26-2022 08:01 AM
I am hoping to write a script on a record producer that changes who the "Opened For" user is based on what group the "Opened By" user is in.
I currently have it set up so that the Opened For person is always the Subject Person's manager (script below). However, I need it changed so that this only occurs when the Opened By is a member of a certain HR Group (Employee Relations). Is it possible to do this right on the record producer script?
I was thinking something like this:
var isER = (gs.getUser().isMemberOf("f65370019f22120047a2d126c42e705c"))
if (isER) {
return current.opened_for = producer.subject_person.manager; }
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-26-2022 08:19 AM
Hi,
update as this
if(gs.getUser().isMemberOf("f65370019f22120047a2d126c42e705c")) {
current.opened_for = producer.subject_person.manager;
}
Regards
Ankur
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-27-2022 08:05 AM
Hi,
like this
if(gs.getUser().isMemberOf("f65370019f22120047a2d126c42e705c")) {
current.opened_for = producer.employee_details_position_manager;
}
new sn_hr_core.hr_ServicesUtil(current, gs).createCaseFromProducer(producer, cat_item.sys_id);
Regards
Ankur
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-27-2022 09:30 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-28-2022 10:21 PM
Hi,
I thought it's a reference and would work directly
so since it's text what will user enter there?
if user is entering email then query and get the sysId and store in opened_for
Regards
Ankur
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-31-2022 06:32 AM
Hi,
It's not a reference field. The user submitting the service will be choosing an employee/position and then their manager populates based on the employee that was chosen. I want the opened for to be whoever populates in that field.
Is this even possible if it isn't a reference field?
Thanks,
Rylie
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-09-2022 03:32 AM
Hi @Ankur Bawiskar ,
we have same requirement but the there not specific for any groups - it should triggers to for all users to there respective managers.
1. subject person should be user
2. opened for should be the manager
we have write the one line script in record producer:-
can you please help me .
Thanks