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

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);

 

Sirri
Tera Guru

Hi@nameisnani ,

 

Are you using flow designer are workflow

If you your using flow deginer. in flow you can set take from first task assigned to is same as second task the you can abort action when same by using the script in flow designer .

 

 

 

Hi @Jaspal Singh  thanks for qr

 

While assigning it self it has to through an error . Please update how to do @Jaspal Singh 

Hi @nameisnani , Comments as shared above should help take care.