- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-15-2016 07:53 AM
On the Problem form, in the "Problem Task" related list below, there is a "New" button for people to add new Tasks to the Problem. In addition to just showing this "New" button to people who have certain roles, we also would like to just show it for people who are selected in some of the fields on the Problem form (namely, the "assigned_to" field which we have re-labeled "IPCM Coordinator", and a field we created called "u_problem_owner").
We have a few ACLs on the Problem_Task table. We have a Create one which limits it to people with "ITIL" role, and a Write one which looks like the screen print below (note that pretty everyone who can create new Problems will have an ITIL role).
So, if the user is either the "IPCM Coordinator" or the "Problem Owner", they should be able to see the New button under "Problem Task" while the others should not. We tried to control this with a List Control, i.e.
We tried two different scripts under "Omit new condition". The one shown above, and this one:
var answer = true;
var user = gs.getUserID();
var owner = problem.u_problem_owner;
var ipcm = problem.assigned_to;
var admin = gs.hasRole('admin');
if (user == owner || user==ipcm || admin){
answer = false;
}
answer;
Neither one worked for us.
The first one showed the "New Task" button for people who were not the "IPCM Coordinator" or the "Problem Owner" (though when they clicked the button, it didn't let them write to any fields). These people should not even see the button.
The second one shows the button for the correct people, but when someone who is the "IPCM Coordinator" or the "Problem Owner" click on the New task button, they get a message saying "Action not authorized".
Can anyone tell us what we are doing wrong?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-15-2016 08:24 AM
But...
It looks like if I use the second script from the original post (using the "Omit filters" option), and change the two references of "problem." in my script to "parent.", it looks like that might just work! I need to do a little more testing to confirm it, but it looks like we may have our answer!
So, the script for the "Omit filters" option now looks like:
var answer = true;
var user = gs.getUserID();
var owner = parent.u_problem_owner;
var ipcm = parent.assigned_to;
var admin = gs.hasRole('admin');
if (user == owner || user==ipcm || admin){
answer = false;
}
answer;

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-15-2016 08:06 AM
Hi Joe,
If you do it in the "List Control" in the "Omit New Button" you should use parent instead of problem, ie:
var answer = true;
var user = gs.getUserID();
var owner = parent.u_problem_owner;
var ipcm = parent.assigned_to;
var admin = gs.hasRole('admin');
if (user == owner || user==ipcm || admin){
answer = false;
}
answer;
Telmo
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-15-2016 08:17 AM
Using that option seems to remove the button for everybody, even the Problem Owner and IPCM Coordinator.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-15-2016 08:24 AM
But...
It looks like if I use the second script from the original post (using the "Omit filters" option), and change the two references of "problem." in my script to "parent.", it looks like that might just work! I need to do a little more testing to confirm it, but it looks like we may have our answer!
So, the script for the "Omit filters" option now looks like:
var answer = true;
var user = gs.getUserID();
var owner = parent.u_problem_owner;
var ipcm = parent.assigned_to;
var admin = gs.hasRole('admin');
if (user == owner || user==ipcm || admin){
answer = false;
}
answer;

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-16-2016 12:05 AM
Hi Joe,
That's "weird". The omit filters should be to remove the "filter" from the related list.
I've tested in my developer environment, and the "Omit Edit Button" is working with this script:
if (gs.getUser().getRecord().getValue('sys_id') != parent.assigned_to){
answer = true;
} else {
answer = false;
}
I only tested with assigned_to field.
Telmo