I am trying to send out an email when the severity of the defect is modified. I want an email to generated only when the severity is modified not when severity is selected for the first.
Following is the code i implemented but its generating an email when a new defect is opened (when severity is selected for the first time).
IF Bug_Fields.field("BG_SEVERITY").IsModified = True Then StrSubject = Bug_Fields("BG_BUG_ID").Value &_ " - "& Bug_Fields("BG_SUMMARY").value
strComment = "USER HAS MODIFIED THE BUG SEVERITY"
strSubject, StrComment End IF
When you create a new defect, in essence all the fields are modified from blank to the value entered/selected. Unless you add something to your query regarding looking for the Defect ID (this is not set until the created defect is saved), I don't know of a way to prevent the emails from being generated when the defect is first created.
You can also configure this email requirement using the Customize > Automail feature instead of directly coding within the workflow script. Again, there is nothing within the Automail feature to prevent the email being generated when the defect is oriiginally created.