- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-30-2016 01:54 PM
Hello Community,
I was wondering if it was possible to grant a user's account rights/roles when they have been inputted into the Assigned to field of Requests.
The situation is, I have locked down certain variables on the request form to not allow any user to make changes to them.
I would like to create a condition where the users name inputted into the Assigned to field will be also granted the role to edit the locked down variable.
In this instance we have secured the Work start/end times. We would like the person in the Assigned to field to be able to make changes to the work start/end times.
Any help to point me in the right direction would be greatly appreciated.
Sincerely,
Orlando Galindo
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-08-2016 01:58 PM
Hello Community,
I was able to answer this in another forum.
Here is the solution:
How to query a certain user's role
- answer = ifScript();
- function ifScript() {
- //answer = 'false';
- var userID = gs.getUserID();
- gs.log("work start check for " + userID + " assigned_to " + current.assigned_to);
- if (userID == current.assigned_to) {
- return 'true'; }
- // query to see if userID has role change management, if so return true
- var cm_role = new GlideRecord('sys_user_role');
- cm_role.addQuery('name', "change_management");
- cm_role.query();
- while (cm_role.next()) {
- var roles = new GlideRecord('sys_user_has_role');
- roles.addQuery('user', userID);
- roles.addQuery('role', cm_role.sys_id);
- roles.query();
- while (roles.next()){
- gs.log("work start role check for " + userID + " has role " + cm_role.name);
- return true;
- }
- }
- gs.log("end of work start role check for " + userID + ", no writing allowed" );
- return false;
- }
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-30-2016 01:58 PM
I had tried ACL's on variable pool but they didn't worked for me.
What I did was used a client script to check if the logged in user is assigned to, then make the variables.<variable_name> readonly false.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-30-2016 02:23 PM
Hello Karan,
Would it be OK to request your client script code so that I may review it?
Thank you
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-30-2016 02:36 PM
On Load script:
var userID = g_user.userID;
if (userID == g_form.getValue('assigned_to'))
{
g_from.setReadOnly('variable.<variable name>', false);
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-05-2016 02:42 PM
Hello Karan,
I tried that code, and I see there may be some type of configuration to fine tune it to my particular scenario.
Would you think there would be a way to snip in a string of code that could be applied the the Access Control for the particular variable like in the screen shot below?
any help would greatly be appreciated.