Jump to content

Global Variables Not Working As Expected


Recommended Posts

Attaching a simplified version of the job file & associated data for reference, but essentially – 

I'm declaring a certain variable globally because it needs to be declared quite a few times throughout this job. However, the variable is not recognized properly when composing or previewing, and only works properly in the rules editor when I open up Javascript Globals first and then preview the rule.

Is it not possible to declare a variable based upon a record in the Javascript globals?

global variable not functioning as expected.pdf sample data.csv

Link to comment
Share on other sites

Review attached to see if this helps. I'm not positive but i don't think you can assign a field value in the global because it does not have access to the field data at that moment. Plus you would want the data to come from each record, not just the moment the variable is created. I also used ToLower() in the switch statement.

global variable not functioning as expected rev1.pdf

  • Like 2
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.

Guest
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...