- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-16-2023 03:50 AM
Hi All,
i have a requirement that in HR task, it has choice field "HR task type' , so basically i want to display two choices only i.e " process and Leave" when the parent case having "HR service" is Benefits" ?
Please help me to resolve this
Thanks
Ramu
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-16-2023 04:01 AM
you can use display BR on HR Task and onLoad client script on HR Task table
Display BR
(function executeRule(current, previous /*null when async*/) {
// Add your code here
g_scratchpad.hrService = current.parent.hr_service.name;
})(current, previous);
onLoad client script:
function onLoad(){
if(g_scratchpad.hrService == 'Benefits'){
g_form.removeOption('hr_task_type', 'choicevalue1'); // ensure you give correct choice value you want to remove here
}
}
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
10-16-2023 04:01 AM
you can use display BR on HR Task and onLoad client script on HR Task table
Display BR
(function executeRule(current, previous /*null when async*/) {
// Add your code here
g_scratchpad.hrService = current.parent.hr_service.name;
})(current, previous);
onLoad client script:
function onLoad(){
if(g_scratchpad.hrService == 'Benefits'){
g_form.removeOption('hr_task_type', 'choicevalue1'); // ensure you give correct choice value you want to remove here
}
}
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
10-16-2023 04:11 AM
@Deepika61 HR task type field controls how a task should render on Service portal. Since this is an OOTB field which is being used in several script includes please do an impact analysis before applying any customisation on this field.