protected override string DoIt() { _req = new MRequest(GetCtx(), GetRecord_ID(), null); // check mail template if found on request or request type. mailText_ID = _req.GetR_MailText_ID(); if (mailText_ID == 0) { MRequestType reqType = new MRequestType(GetCtx(), _req.GetR_RequestType_ID(), null); if (reqType.GetR_MailText_ID() > 0) { mailText_ID = reqType.GetR_MailText_ID(); } } if (mailText_ID == 0) { GetReqHistory(); if (_reqAction == null) { return(Msg.GetMsg(GetCtx(), "R_NoReqChanges")); } string changedValues = _reqAction.GetChangedValues(); bool _changed = false; sendInfo = new List <String>(); if (!string.IsNullOrEmpty(changedValues)) { string[] strValues = changedValues.Split(','); if (strValues.Length > 0) { for (int i = 0; i < strValues.Length; i++) { _changed = true; sendInfo.Add(strValues[i]); } } } #region commented // //if (_req.GetR_RequestType_ID() != _reqAction.GetR_RequestType_ID() && _reqAction.GetR_RequestType_ID() > 0) //{ // _changed = true; // sendInfo.Add("R_RequestType_ID"); //} //if (_req.GetR_Group_ID() != _reqAction.GetR_Group_ID() && _reqAction.GetR_Group_ID() > 0) //{ // _changed = true; // sendInfo.Add("R_Group_ID"); //} //if (_req.GetR_Category_ID() != _reqAction.GetR_Category_ID() && _reqAction.GetR_Category_ID() > 0) //{ // _changed = true; // sendInfo.Add("R_Category_ID"); //} //if (_req.GetR_Status_ID() != _reqAction.GetR_Status_ID() && _reqAction.GetR_Status_ID() > 0) //{ // _changed = true; // sendInfo.Add("R_Status_ID"); //} //if (_req.GetR_Resolution_ID() != _reqAction.GetR_Resolution_ID() && _reqAction.GetR_Resolution_ID() > 0) //{ // _changed = true; // sendInfo.Add("R_Resolution_ID"); //} //// //if (_req.GetSalesRep_ID() != _reqAction.GetSalesRep_ID() && _reqAction.GetSalesRep_ID() > 0) //{ // _changed = true; // sendInfo.Add("SalesRep_ID"); //} //// //if (_req.GetPriority() != _reqAction.GetPriority() && !string.IsNullOrEmpty(_reqAction.GetPriority())) //{ // _changed = true; // sendInfo.Add("Priority"); //} //if (_req.GetPriorityUser() != _reqAction.GetPriorityUser() && !string.IsNullOrEmpty(_reqAction.GetPriorityUser())) //{ // _changed = true; // sendInfo.Add("PriorityUser"); //} //if (_req.GetSummary() != _reqAction.GetSummary() && !string.IsNullOrEmpty(_reqAction.GetSummary())) //{ // _changed = true; // sendInfo.Add("Summary"); //} #endregion if (sendInfo.Count > 0 && _changed) { prepareNotificMsg(sendInfo); // For Role Changes Thread thread = new Thread(new ThreadStart(() => SendNotices(sendInfo))); thread.Start(); return(Msg.GetMsg(GetCtx(), "R_EmailBackgrndRun")); } else { return(Msg.GetMsg(GetCtx(), "R_NoReqChanges")); } } else { prepareNotificMsg(sendInfo); // For Role Changes Thread thread = new Thread(new ThreadStart(() => SendNotices(sendInfo))); thread.Start(); return(Msg.GetMsg(GetCtx(), "R_EmailBackgrndRun")); } return(""); }