Condition to add updated by should not be part of one fulfiller assignment group

Rajavardhini
Tera Contributor

Hi Team,

 

I have a requirement to change the color of Number in agent workspace when last Updated by user is not part of fulfiller group.

 

I am using Highlight Values in now experience module and trying to keep condition like as below.

 

javascript:current.sys_updated_by.isMemberOf('1a433de24759461012dd9bed316d43c6');

 

Rajavardhini_0-1730712790876.png

Could you please help me to add the condition that updated by should not be the member of fulfiller group.

 

Regards,

Raj

 

3 REPLIES 3

Uncle Rob
Kilo Patron

So the problem is that sys_updated_by is not a reference to user.   Observe

UncleRob_0-1730723310626.png


The original design prioritized knowing who did what... and since users could become inactive or deleted, they opted to make those system fields (created by / updated by) to just hold the string of the user id at that point in time.  Observe.... (dictionary entry for task.sys_updated_by)

UncleRob_1-1730723428602.png

 

Mark Manders
Mega Patron

sys_updated_by isn't a reference to the user table. You need to do this through a script include, so you can query to the user table, find the user that updated and validate that the user isn't part of the assignment group.

The 'isMemberOf' now also has a hardcoded sys_id, which will always check on the same group.


Please mark any helpful or correct solutions as such. That helps others find their solutions.
Mark

Hi Mark thanks for your response,

I have tried using below code using script include but its not working.

Script Include:

 

var Check_customer_update = Class.create();
Check_customer_update.prototype = {
    initialize: function() {},

 

    check_cust_update: function() {
        var user = current.sys_updated_by;
        var groupName = "CEP UK Team";

 

        //Get Users sys_id
        var usrGr = new GlideRecord('sys_user');
        if (usrGr.get('user_name', user)) {
            userID = usrGr.sys_id + '';
        } else {
            //we didn't find the user return false

 

            return false;
        }
        //get Group sys_id
        var grpGr = new GlideRecord('sys_user_group');
        if (grpGr.get('name', groupName)) {
            groupID = grpGr.sys_id + '';
        } else {
            //we didn't find the group return false
            return false;
        }

 

        //Now see if they are a member of the group

 

        var grpMbr = new GlideRecord('sys_user_grmember');
        grpMbr.addQuery('user', userID);
        grpMbr.addQuery('group', groupID);
        gr.query();

 

        if (gr.next()) {
            return true;
        }
        return false;

 

    },
    type: 'Check_customer_update'
};
 
Business rule:
After Update:
(function executeRule(current, previous /*null when async*/ ) {

   var test= new Check_customer_update().check_cust_update();
 
  gs.addInfoMessage(test+" "+'update');

   

})(current, previous);