SOLVED: BPM keep sending the same emails over and over again (Loop issue)


(Michel Serry) #1

We have one BPM that huse to send email alerts under certain conditions. For some reason, after some of the code was chagned, it caused a loop and now users are flooded with emails coming from E10.

We have reverted the BPM to the old code, we have restarted both app servers but as soon as they come back online, the emails starts again.

Is there a queue somewhere we can look at? How can we stop this?

Thanks,


(Aaron Moreng) #2

What’s the code?


(Michel Serry) #3

The BPM is now turned off but the email flood continues. I don’t think the problem is with the code… we are trying to find the source of where the email are coming from.


(Aaron Moreng) #4

Well, if it’s on a BPM, the BPM must be getting triggered from something. Is it a data directive or method?


(Michel Serry) #5

Its a method.


(Aaron Moreng) #6

What method? You’re not giving me much to go on here :slight_smile:
Sharing your code would be helpful, because as you stated, there was a code change and then this problem happened.


(Michel Serry) #7

My programmer is extracting the code, I will send it soon.

When a BPM send an email alert, is the email queued somewhere in the database?


(Michel Serry) #8

Code:

callContextBpmData.Character01 = “”;
callContextBpmData.Character02 = “”;
callContextBpmData.Character03 = “”;
callContextBpmData.Character04 = “”;
callContextBpmData.Character05 = “”;
callContextBpmData.Character06 = “”;
callContextBpmData.Character14 = “”;
callContextBpmData.Character15 = “”;
callContextBpmData.Character16 = “”;
callContextBpmData.Character17 = “”;
callContextBpmData.Character18 = “”;
callContextBpmData.Checkbox01 = false;

string strSalesRepCode = “”;
string strCompany = “”;
string strTaskDesc = “”;
string strCustomer = “”;
int intHDCaseNum = 0;
string strProjectID = “”;
string strComment = “”;
string strPMName = “”;
string strUserID = callContextClient.CurrentUserId;
bool blEmailShouldBeSent = true;
string strEmlSubject="";
string strEmlBody="";

int intCounter = -1;
bool blnGotIn = false;

foreach(var rowTask in ttTask)
{
intCounter++;
if (intCounter == callContextBpmData.Number01)
{
blnGotIn = true;

	strSalesRepCode = rowTask.SalesRepCode;
	strCompany = rowTask.Company;
	intHDCaseNum = Convert.ToInt32(rowTask.Key1);
	strTaskDesc = rowTask.TaskDescription;
	strComment = rowTask.TaskComment;				

	/////////////////////////////////////////////////////////...do more stuff//////////////////////////////////////////////
}

}

if (!blnGotIn)
{
callContextBpmData.Number01 = -1;
}
else
{
callContextBpmData.Number01++;
}


(Aaron Moreng) #9

To answer your first question, it does not queue in the database. The BPM Send Mail action creates a mail client within the code. The “Custom Code Block” object in the BPM is simply a class.
Ok so you are setting some stuff inside a foreach loop based on ttTask. Have you verified the contents of the ttTask object?
Secondly, do you know what part of this code changed from before?


(Michel Serry) #10

SOLUTION: All the emails created by a loop inside a BPM were queued inside these 2 tables:

ice.MailQueue
ice.MailQueueBody

There was 1994000 emails still waiting to be processed. We cleared it up and we were able to stop the flood of emails.

Thanks to Joe Grafner from E10 Support that pointed us where to look.


(Jose C Gomez) #11

Crazy! Great info thought.


(Michel Serry) #12

Thanks for your help today Jose!