- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-07-2015 01:51 AM
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.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-07-2015 01:56 AM
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
Harish
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-20-2016 05:02 PM
Do you know if there's something weird where business rules created before upgrading to Helsinki aren't allowed to use the Helsinki format? Because I'm trying to change it to use that instead of onAfter and it's giving me that Missing function declaration for onAfter
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-20-2016 10:30 PM
bcronrath, have you put the code inside like this:
(function executeRule(current, previous /*null when async*/) {
// Add your code here
})(current, previous);
?
My guess is that older stuff still work, but if you trying to change them and save, they need to be in the "new" format.
//Göran
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-21-2016 09:37 AM
That's the exact code I'm trying to put but it keeps telling me Missing function declaration for OnAfter, whenever I try to edit older business rules. It lets me save that type of code just fine newly created ones (it defaults to this style of code)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-21-2016 09:58 AM
See my "mini-revelation" from 6/13 above:
On a related note, I just realized that there's now an "Execute Function" field on business rules deciding whether or not these functions will be automatically run. (If you also get the crazy idea to try manually converting a pre-Fuji business rule to the new approach, make sure you set this field to true!)
It sounds like you may need to check that box.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-21-2016 10:21 AM
Ah ha, I just re-read your original issue. Maybe you actually had to un-check that box when switching to the generic (executeRule) function? (I assume it was still checked/"true", so the system was looking in your script for an onAfter function, which you had just removed.)