I am trying to figure out how to set up a script to run when someone attempts to enter information into the subject line of an email. We have a mail security appliance that sends encrypted messages and one of the ways to bypass this is by adding a special tag at the end of the subject. For example
This is a subject - TAG
I had modified some of the scripts in our CRM 2011 environment but we recently deployed a CRM 2015 environment and none of the old scripts seem to be working. I am wondering if anyone could help me get this to work?
I went to Settings > Customizations > Customize the System > Web Resources
From here I went to New and crated a resource of type Script (JScript) named New_Email_Form_Library (it appended New not sure why, I don't see an existing one). I browsed out to my .js file and uploaded it. I then published all customizations.
Here is a screenshot of the properties of this solution.
So I then went over to the Entites > Email > Forms section went to the Email Form and then selected the Subject field and went to the Events tab and added the library and then set up the event handler as I would have in CRM 2011.
So then I use the large + in the ribbon to create an email and when I attempt to input anything into the subject nothing happens. I added a test function which simply runs "alert" and that does not function either. Any ideas?
// Get the field that fired the event.
var oField = Xrm.Page.getAttribute("subject"); // get subject attribute
// Validate the field information.
if (oField.getValue() != null && oField.getValue() != undefined && oField.getValue() != "");
var x = confirm("I confirm that there is not BLAHBLAH in this email");
if (x == true);
oField = oField + " - TAG";