I previously wrote about automating the initial setup of User Variables. I needed to add a new variable to the process and encountered an issue with the script. Fortunately, it was an easy fix.
The new variable added had the hyphen character “-“ in the name.
I added the new variable to the script and assigned a member.
I deployed the updated rule, opened the form Initial Setup, and clicked Save. It failed.
The error is stating that the variable “Canada” does not exist. That’s true since the variable created is named “US-Canada”. Looking more closely at the line we can see that the character between the dimension name and the variable name is also a “-“. Further down in the script where the mapping is defined, we see that the “-“ character was defined as the split character.
So, with a variable name having the same character as the mapKey.split, the script was not able to distinguish correctly between the dimension and the variable name. We needed a unique character for the split.
I tried several different characters but continued to get errors. I settled on using a double hyphen “–“. The mapKey.split was updated as well as all the variable assignments.
The rule was saved and deployed. From the form, we clicked Save and it was successful.
Now that I know of this issue, I’ll be more careful in how I name variables.
As always, happy EPM’ng!