- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-26-2023 08:01 AM
I want show particular field on the form only when assigned to is part of Service Desk Group and only for opened by user. how to acheive this..?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-26-2023 11:30 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-26-2023 11:53 PM
Hi @Mannam Praveen ,
You need to write some onload client script and display business rule like the one below.
onLoad Client Script:
function onLoad() {
if(g_scratchpad.display_particular_field == true){
g_form.setVisible('your_field_name', true); //chnage it to your field name
}else{
g_form.setVisible('your_field_name', false); //chnage it to your field name
}
}
Display Business Rule:
(function executeRule(current, previous /*null when async*/) {
var memGr = new GlideRecord('sys_user_grmember');
memGr.addQuery('user', current.assigned_to);
memGr.addQuery('group', 'd625dccec0a8016700a222a0f7900d06');
memGr.query();
if(memGr.next()){
g_scratchpad.display_particular_field = true;
}else if(user == current.opened_by){
g_scratchpad.display_particular_field = true;
}else{
g_scratchpad.display_particular_field = false;
}
})(current, previous);
Please mark my answer helpful and accept as solution if it helped you 👍✔️
Anvesh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-26-2023 11:53 PM
Hi @Mannam Praveen ,
You need to write some onload client script and display business rule like the one below.
onLoad Client Script:
function onLoad() {
if(g_scratchpad.display_particular_field == true){
g_form.setVisible('your_field_name', true); //chnage it to your field name
}else{
g_form.setVisible('your_field_name', false); //chnage it to your field name
}
}
Display Business Rule:
(function executeRule(current, previous /*null when async*/) {
var memGr = new GlideRecord('sys_user_grmember');
memGr.addQuery('user', current.assigned_to);
memGr.addQuery('group', 'd625dccec0a8016700a222a0f7900d06');
memGr.query();
if(memGr.next()){
g_scratchpad.display_particular_field = true;
}else if(user == current.opened_by){
g_scratchpad.display_particular_field = true;
}else{
g_scratchpad.display_particular_field = false;
}
})(current, previous);
Please mark my answer helpful and accept as solution if it helped you 👍✔️
Anvesh