Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Missing function declaration for onBefore error on Business Rule

mitzaka
Mega Guru

Hi SNC,

I am trying to write a Business Rule but whatever I do I get this message: Missing function declaration for onBefore.

I am on Fuji, and have never seen this so far.


Would appreciate any tips on what I am doing wrong.

1 ACCEPTED SOLUTION

Harish KM
Kilo Patron
Kilo Patron

Hi..


  In fuji, write the code inside that function



function onBefore(current, previous) {


    //This function will be automatically called when this rule is processed.



// your code here


}




or



function onBefore(current, previous) {


    //This function will be automatically called when this rule is processed


}


// your code here



Thanks'


Harish


Regards
Harish

View solution in original post

19 REPLIES 19

Harish KM
Kilo Patron
Kilo Patron

Hi..


  In fuji, write the code inside that function



function onBefore(current, previous) {


    //This function will be automatically called when this rule is processed.



// your code here


}




or



function onBefore(current, previous) {


    //This function will be automatically called when this rule is processed


}


// your code here



Thanks'


Harish


Regards
Harish

Thanks, that was the case. Fuji stuff:)


A quick follow up question. We are on eureka and dont have this "function onBefore" etc. on for example our business rules. Do we need to fix this before upgrading to fuji?


@ - you don't need to do anything. Just go and upgrade and don't worry about it.


For already existing rules you don't have to edit. You have to write in the new syntax for the new ones which you will create.



Cheers!