I use a Data Directive to create specific email messages within Epicor to be distributed. I began using the Global Alerts, but found I could not always have the email contain the information I needed to convey.
For example, I have an email that is distributed to our A/P team, when an employee is InActivated or Terminated, as A/P needs to InActivate the Supplier record so the ex-employee does not accidentally get paid for expenses in the future.
The data directive checks on the Employee Status and if the EMPSTATUS field is not equal to “A”, the directive runs my custom code to create and distribute the email message. I can send a screen shot of the code to set-up the email message, if you wish.
@brandtley - I assume that in the BPM workflow designer you are replacing the ‘send email’ with ‘execute custom code’?
I have been looking at your code and have tweaked it to suit my needs, but I am not an expert here. I am getting an error with part of the code and am not sure how to fix it.
@MEP did you mean to reply to @WhileE? I can’t seem to think of a way you could link AlertQue to Task. What if you triggered based on something else using a Method Directive? It would give you a lot more information to work with. What different actions in Case Entry are triggering alerts?
Apologies, the code belonged to @gpayne
Looks like I got confused . Let’s start again.
I need to send an email alert when a task is created on Case entry. Sending it to the email the task is assigned to.
Originally I was using the global alert (1390) to send the alert to the Alert Que, then using a Data Directive BPM on the alert Que to send an email to the assigned person.
The problem is the limited information available in the alert que to be used in the email.
It looks like the suggestion is to scrap the global alert and instead use a BPM directly on the Task table. I looked at the available methods, but couldn’t decide on which one. @gpayne is suggesting a data directive.
I added a standard BPM to the task table. Set a condition that triggers when a row is added to the task table. Then linked the true output of the condition to an execute custom code.
I then copied in Greg’s code, carefully adjusted it (I mean butchered it )
Saved and enabled the BPM. Tested it and…nothing!
I must have something wrong. Most likely I ruined some perfectly good code. Sorry!
Does it sound like I am on the right track or not?
@MEP It is a place to start. The Log.WriteEntrys will write to the Appserver Event Viewer and the serverlog if you have that on. The code checks for added so you don’t need a condition.
The event viewer should at least show the starting and ending lines if the routine fired at all.
Looking at the code I uploaded it appears I pre-butchered it taking out some odd conditions we have. Here is code that should fire after you change just the email addresses and user to your user. Email Alert on HDCase Task sample.cs (3.7 KB)
I appreciate you helping me, I know it’s a struggle.
Thank you for the amended code. I have installed it on the task table. A data directive with a standard BPM to execute custom code.
I have emended your code to use my own email addresses, but not adjusted anything else until I can get it working.
I have enabled the BPM and tested by adding a new case entry which creates a new task. I can see the task is enable and exists in the task list, but there is no email alert.
I have enabled tracing and reviewed the log, but cannot see any reference to the BPM.
I guess I still have something wrong. Where should I see the log entry, as I seem to not know?