//Set up email trigger /* To change the name of the attribute, edit the variable list 1)MAKE SURE YOU PUT THE CORRECT EMAIL GROUP ADDRESSES IN THE INDIVDUAL TRIGGERS! 2)ADD THE EMAIL GROUPS ON THE SMTP SERVER 3)MAKE SURE THE MODULE IS IN A PROJECT 4)RUN SCRIPT FROM WITHIN MODULE */ //================================================================= // Define Constants //================================================================= const string eMailTriggerAttr_1 const string eMailTriggerAttr_2 const string emailTriggerForAttr_1 = "Trigger for AL-State" const string emailTriggerForAttr_2 = "Trigger for AL-Status" const string attrName_1 = "AL-State" const string attrName_2 = "AL-Status" const string subjectLine = "Change in Status" Trigger t_1, t_2 string trigName //================================================================ // This loops through project and deletes any existing // triggers with same variable //================================================================ for t_1 in current Project do { trigName = name(t_1) if (trigName == emailTriggerForAttr_1 || trigName == emailTriggerForAttr_2) { if (confirm "Replace Email Trigger?") delete(t_1) } } //================================================================ // Setting up trigger for First Attribute //================================================================ eMailTriggerAttr_1 = " Object o = current const string attrName_1 = \"AL-State\" const string attrValue1_ForName_1 = \"New\" const string attrValue2_ForName_1 = \"Light Analysis\" const string emailAddress_1 = \"freddy.kruger@elmstreet.com\" const string emailAddress_2 = \"anthony.giorgianni@telelogic.com\" const string subjectLine = \"Change in Status for \" identifier o \"\" string triggerValue = (value current Trigger) string emailMsg = \"The attribute: \" attrName_1 \" for ID: \" identifier o \": \" o.\"Object Text\" \" has changed from: \" o.attrName_1 \" to: \" triggerValue \"\" if (triggerValue == attrValue1_ForName_1){ if (sendEMailNotification( \" Module \" name current Module , emailAddress_1, subjectLine, emailMsg) == false) ack \"Failed to send email\" } if (triggerValue == attrValue2_ForName_1){ if (sendEMailNotification(\" Module \" name current Module, emailAddress_2, subjectLine, emailMsg) == false) ack \"Failed to send email\" } " //================================================================ // Installing First Trigger //================================================================ t_1 = trigger(emailTriggerForAttr_1,attribute->attrName_1 ,pre,save,10,eMailTriggerAttr_1) //================================================================ // Setting up trigger for Second Attribute //================================================================ eMailTriggerAttr_2 = " Object o = current const string attrName_2 = \"AL-Status\" const string attrValue1_ForName_2 = \"Approved\" const string emailAddress_3 = \"anthony.giorgianni@telelogic.com\" const string subjectLine = \"Change in Status for \" identifier o \"\" string triggerValue = (value current Trigger) string emailMsg = \"The attribute: \" attrName_2 \" for ID: \" identifier o \": \" o.\"Object Text\" \" has changed from: \" o.attrName_2 \" to: \" triggerValue \"\" if ((value current Trigger) == attrValue1_ForName_2){ if (!sendEMailNotification( \" Module \" name current Module, emailAddress_3, subjectLine, emailMsg)) ack \"Failed to send email\" } " //================================================================ // Installing Second Trigger //================================================================ t_2 = trigger(emailTriggerForAttr_2,attribute->attrName_2,pre,save,11,eMailTriggerAttr_2)