wrong subject change approval notifiaction trigger issue

Jyoti Ranjan Se
Tera Contributor

Hi Everyone,

 In normal change needs two approvals one is group another is technical approval.it will happen one by one

my issue is when group approval is trigger then systems sent a notification to approver for approval. but it sent wrong subject of technical approval and when technical approval sent it also sent technical approval mail subject. and sometime its goes well. for this we use a mail script 

//////

//

var changeType = current.sysapproval.type;
    var changeState = parseInt(current.sysapproval.state);
    if(changeType == 'normal' && changeState == -4){
        subject = gs.getMessage('SA approval is requested from you for {0}, {1}.', subjectArray);
    }
    else if(changeType == 'normal' && changeState == -3){
        subject = gs.getMessage('CAB approval is requested from you for {0}, {1}.', subjectArray);
    }
   
    email.setSubject(subject);
/////

can anyone help me on this

4 REPLIES 4

Community Alums
Not applicable

Hi ,

 

Please check the triggering condition for the notification.

thats working fine

 

Community Alums
Not applicable

Hi,

 

We can debug in this way, first we can check what change state is returning. I feel in both cases change state is returning as -4. That might be the reason it is going to if loop.

Sarika S Nair1
Kilo Sage
 
Can you try to trigger it by adding toString() after type ?like below
 var changeType = current.sysapproval.type.toString();
    var changeState = parseInt(current.sysapproval.state);
    if(changeType == 'normal' && changeState == -4){
        subject = gs.getMessage('SA approval is requested from you for {0}, {1}.', subjectArray);
    }
    else if(changeType == 'normal' && changeState == -3){
        subject = gs.getMessage('CAB approval is requested from you for {0}, {1}.', subjectArray);
    }
   
    email.setSubject(subject);