Jump to content

function call from an external JS file

Recommended Posts



I'm using the Load() function in my OnJobStart to load an external JS file. I'm calling a function from that file in my OnRecordStart, and it works, but when I save/validate the OnRecordStart rule I get the attached error message.


Does anyone know how to get rid of this error message?


In case you can't see the image, it's a ReferenceError that states the function is not defined.


Edited by merski007
Link to comment
Share on other sites

Actually, you shouldn't need the OnJobStart rule at all, if all it's doing is loading the JS file. You can just do this at the top of the rule that's calling the function from the external JS file:

if (FusionPro.inValidation || typeof [color="Green"]setOutputType[/color] == "undefined")

Using your own function name and file name (in green above), of course.

Link to comment
Share on other sites

Thanks Dan and Step, both worked great.


Since I'm loading multiple JS files in the OnJobStart, I'm thinking it would be safer to use Step's method, since that calls the rule and all files will be loaded.


We are just diving into the external JS file callout methods and so far they have been a big help. We do a ton menu products that share the same rules, so this is becoming a real lifesaver on preventing us from writing duplicate code in each template.


Thanks for the helps and have a Happy New Year!

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...