Greetings All,
I am having a problem with some JavaScript code that I am trying to run from a trigger. For some odd reason it appears that my declared variables are being set to null after they get used once. My code is below.
My first call to the script library yields the result that I want, it creates an HTML message. However, the second call yeilds nothing as the 'interaction' variable gets set to null after the first script library call.Code:var newRec = record; var oldRec = oldrecord; //MSG4504: (Mail the Contact) Interaction Closed if (newRec.open=="Closed") { var interaction = newRec.incident_id; var contact = newRec.contact_name; system.library.MtlNotificationLibrary.generateMessage("MSG4504",interaction,"MSG4504",contact,"individual"); interaction = newRec.incident_id; print("interaction: "+interaction); var infoRep = newRec.alternate_contact; system.library.MtlNotificationLibrary.generateMessage("MSG4510",interaction,"MSG4510",infoRep,"individual"); }
You will notice the first two lines create variable to hold record and oldrecord as I have encountered this variable anomaly before. It seems as though once you pass a variable off to a script library, it cannot be used in the trigger again. It is really frustrating.
Has anyone ever encountered this before?
Thanks,
Warren


Reply With Quote

Bookmarks