Add UI action to "action on selected rows

sparkles
Tera Contributor

Hi,

 

I created "assign to me" ui action to show under "action on selected rows", I need help with the condition and script.

its for HR table. I found this condition (new global.IncidentUtils().canAssignToMe(current)) for incident table but not sure how to change it so it can work with HR,  HR table name is "sn_hr_core_case" and the 

Extends table is Task
 

.

 

thanks

P.S:

here is the script for the incident condition:

 

assignToMe();

function assignToMe() {
    if (current.assignment_group.nil()) {
        var memberGroups = new global.IncidentUtils().getMemberGroups(gs.getUserID(), 2);
        if (memberGroups.length > 1) {
            gs.addErrorMessage(gs.getMessage("Assigned to user {0} is member of multiple groups, please select one as Assignment group ", [gs.getUserDisplayName()]));
            return;
        }
        if (memberGroups.length == 1)
            current.assignment_group = memberGroups[0];
    }
    current.assigned_to = gs.getUserID();
    current.update();
}
0 REPLIES 0