How to restirct assigning 2 sctasks from same ritm

nameisnani
Mega Sage

 

 

How to restrict assigning 2 sctasks to a same member when the tasks are generated from same ritm . 

 

nameisnani_0-1701069773422.png

 

@Aman Kumar S  @sonamtiwari 

 

 

1 ACCEPTED SOLUTION

Jaspal Singh
Mega Patron
Mega Patron

Hi

You need a before Insert/update BR on the Catalog Task table which runs when 

Assigned To | changes

(function executeRule(current, previous /*null when async*/ ) {

    var ritmis = new GlideRecord('sc_task');
    ritmis.addQuery('request_item', current.request_item);
    ritmis.addQuery('assigned_to', current.assigned_to);
    ritmis.query();
    if (ritmis.next()) {
        gs.addErrorMessage('Assigned user already has another task for the RITM. Please assign it to othe user');
        current.setAbortAction(true);
    }

})(current, previous);

 

View solution in original post

5 REPLIES 5

Hi @Jaspal Singh 

 

I have wirtten this BR on ritm table , 

 

nameisnani_0-1701166911465.png

nameisnani_1-1701166929624.png

 

 

Here we are triggering sequential task . I am going to assign same person to 2nd task it should through an error .Which is not working ,

 

nameisnani_2-1701167055596.png

 

@Jaspal Singh  Please provide me solution to fix this issue