MES function query

Hello everyone,

I wanted to know that, if we define a checklist tasks in the project entry and assigned it to a person, then how can Epicor notifies that person about the task using the MES.?

Any help would be great.

Thanks in advance.
Rishi

We have this same situation and did 2 things. First we built a dashboard that users keeps open to see any check list tasks assigned to them. We also created a BPM that sends an email when the person on the ProjectTask table changes.

So, we created a BPM workflow design. But we cannot see any email id column.


Here we can only see the PersonID.

So how can we fetch the email ID from this PersonID field?

You have to add a caller to run some custom code to grab the email address.
2022-05-17 05_53_46-code block

I’m not a programmer so I get someone to write the code for me. Here is the code from our block.

//determine the email of the Workforce AND whether or not that Workforce is a Project Manager
//NOTE: Workforce is the same thing as SalesRep
//NOTE: NOT YET altered and saved in both EAPP01 and EAPP02.

string strSalesRepCode = “”;//callContextBpmData.Character03;
string strCompany = “”; //callContextBpmData.Character02;
string strUserID = callContextClient.CurrentUserId;
bool blEmailShouldBeSent = true; //assume that the email should be sent until determined otherwise
string strEmlSubject=“”;
string strEmlBody=“”;

foreach(var row in ttProjPhase)
{
//Q: What is the field for Assigned To in WBS Phase?
strSalesRepCode = row.UDField<System.String>(“SalesRepCode_c”);
strCompany = row.Company;

// if the user who is making the change is the assignee, do not send the email

//		look up the current user's sales rep code
var qUserComp = from qUC in Db.UserComp 
	where qUC.DcdUserID == strUserID && qUC.Company == strCompany 
	select qUC;

//	debug messagebox
//this.PublishInfoMessage("User's Primary Sales Rep="  +qUserComp.FirstOrDefault().PrimSalesRepID, Ice.Common.BusinessObjectMessageType.Information, Ice.Bpm.InfoMessageDisplayMode.Individual, "BPM", "Task Reassigned");

if(strSalesRepCode == qUserComp.FirstOrDefault().PrimSalesRepID) 
{
	//override anything that would allow the email to be sent
	blEmailShouldBeSent = false;

	//debug messagebox
	//this.PublishInfoMessage("You should not receive an email.", Ice.Common.BusinessObjectMessageType.Information, Ice.Bpm.InfoMessageDisplayMode.Individual, "BPM", "Task Reassigned");
}

if(blEmailShouldBeSent) 
{
	//look up email address of Task's SalesRep
	var qSalesRep = from qSR in Db.SalesRep 
		where qSR.SalesRepCode == strSalesRepCode && qSR.Company == strCompany 
		orderby qSR.SalesRepCode descending 
		select qSR;
	
	callContextBpmData.Character01 = qSalesRep.FirstOrDefault().EMailAddress; 
	//blEmailShouldBeSent = qSalesRep.FirstOrDefault().AlertFlag;
	string strSRRole = qSalesRep.FirstOrDefault().RoleCode;
	
	//only project managers should get the email
	if(strSRRole != "PROMAN" && strSRRole != "PROJCOO")
	{
		blEmailShouldBeSent = false;
	}
	
	// for debugging purposes, send everyone the emails despite their alert flag
	//blEmailShouldBeSent = true; 
	// debug line commented out on both servers
	
	
	if(String.IsNullOrEmpty(callContextBpmData.Character01))
	{
		callContextBpmData.Character01="rnewell@pattisonsign.com";
	}

	// If it is known, set who reassigned this message.
	if(String.IsNullOrEmpty(qUserComp.FirstOrDefault().Name)==false)
	{
		callContextBpmData.Character04 = " by " + qUserComp.FirstOrDefault().Name;
	}
	// add a period regardless because the sentence in the email needs one
	callContextBpmData.Character04 += ".";
}

callContextBpmData.Checkbox01 = blEmailShouldBeSent; 

}

We just happen to use a UD field not the PersonID.

Thank you for your reply @rnewell .
Could you please also share your email design template if possible.?

Thanks
Rishi

email

Thank you for your help @rnewell, i’ve tried it and the syntax was also valid but somehow, the mail is not received by the concerned person.

If you test with an email address directly in the email template does it work? Do you have any other auto email that works out of Epicor? We also test with a message box to confirm the correct email address is being passed.

Yes, it works when we use the direct email address. We might have another software that uses auto email. Is that might be a problem?

As long as Epicor is sending the Email with a direct email address then we know you have the Company Configuration and your SMTP server setup correct so no the other software would not be an issue. So if you have a direct email and the other in the CC: field do it show the right address in the email when it arrives at the direct email address? It sounds like the email is not being formatted exact in the code possibly?

Yes it shows the correct email address, with correct formatting which we had defined for the direct mailing.

is there anything which might be creating problem?

I’m not sure why one address would work and not another unless its blocked somewhere else in a firewall or junk. Can you see it in the SMTP log being processed?

I’m not sure what to look into logging. But it is showing everything like new task assigned and all.
Can you specify what to see?

Sorry I’m not a SMTP user. I just know our provider was able to see if an email was being blocked.

If you check the system monitor are you getting an error message?