Business Rule Error Message not working

Saib1
Tera Guru

Hi,

I have Business Rule and the error messgae is getting displayed eventhough i have filled the worknotes and update

When - Before

Condition - State changes to Assess

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

var leadTime = gs.getProperty('pan.bt.change.lead.time');

if(leadtime == 'true')

{

          if (current.work_notes == '') {
        gs.addErrorMessage('Change has been marked "Expedite", please provide the justification in Notes section.'); 
          /current.setAbortAction(true);
            current.state = previous.state;
            gs.setRedirect(current);
        } else
            current.u_expedite_change = true;
   }
})(current, previous);

1 ACCEPTED SOLUTION

Abhijit4
Mega Sage

try below,   

if (current.work_notes.getJournalEntry(1)=="") { //change this line
        gs.addErrorMessage('Change has been marked "Expedite", please provide the justification in Notes section.'); 
          /current.setAbortAction(true);
            current.state = previous.state;
            gs.setRedirect(current);
        } else
            current.u_expedite_change = true;

Let me know if you have any further queries.

Please mark this as Correct or Helpful if it helps.

Regards,
Abhijit
Community Rising Star 2022

By marking my response as correct or helpful, you contribute to helping future readers with similar issues.
Regards,
Abhijit
ServiceNow MVP

View solution in original post

6 REPLIES 6

Abhijit4
Mega Sage

try below,   

if (current.work_notes.getJournalEntry(1)=="") { //change this line
        gs.addErrorMessage('Change has been marked "Expedite", please provide the justification in Notes section.'); 
          /current.setAbortAction(true);
            current.state = previous.state;
            gs.setRedirect(current);
        } else
            current.u_expedite_change = true;

Let me know if you have any further queries.

Please mark this as Correct or Helpful if it helps.

Regards,
Abhijit
Community Rising Star 2022

By marking my response as correct or helpful, you contribute to helping future readers with similar issues.
Regards,
Abhijit
ServiceNow MVP

how this will work? by adding this line . Can you explain me?

if (current.work_notes.getJournalEntry(1)=="")

Hi ,

When i do testing on it. 

I am getting this error message everytime

Kalyani Jangam1
Mega Sage
Mega Sage

if(leadtime == 'true')// here leadTime need