- 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:27 AM
Hi @Mannam Praveen
Use below script,
var assignedTo = current.assigned_to;
var gr = new GlideRecord('sys_user_grmember');
gr.addQuery('user', assignedTo);
gr.addQuery('group', 'IT Service Desk');
gr.query();
if (gr.next()) {
var openedBy = current.opened_by;
var currentUser = gs.getUserID();
if (openedBy == currentUser) {
current.setDisplay('field_to_show', true);
}
}
Thanks,
Anand
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-26-2023 06:57 PM
We need write this script in the business rule right
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-26-2023 11:30 PM
Yes the script is in business rule.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-27-2023 02:04 AM