Custom code condition

Hello guys
i have an issue with a custom code condition i added the below code and i get this error
‘FakeDirective.CustomCodeCondition()’: not all code paths return a value

foreach(var eco in (from ecorow in ttECORev
select ecorow ))
{
foreach(var pp in ( from pprow in Db.PartPlant
where (eco.Company == pprow.Company)&& (pprow.PartNum == eco.PartNum) && (pprow.Plant == eco.Plant)
select pprow ))
{
if (pp.NonStock == false && eco.AutoRecOpr == 0 && eco.FinalOpr != 0)
{
ErrorRev = "Y";
this.PublishInfoMessage("Step:", Ice.Common.BusinessObjectMessageType.Error, Ice.Bpm.InfoMessageDisplayMode.Individual, string.Empty, string.Empty);
}
}}

With a code condition it is expecting a true or false to be returned. You could do something like below and by passing a true / false back from the condition you could just use the Message Widget to display what you want.

foreach(var eco in (from ecorow in ttECORev
select ecorow ))
{
	foreach(var pp in ( from pprow in Db.PartPlant
	where (eco.Company == pprow.Company)&& (pprow.PartNum == eco.PartNum) && (pprow.Plant == eco.Plant)
	select pprow ))
	{
	if (pp.NonStock == false && eco.AutoRecOpr == 0 && eco.FinalOpr != 0)
		{
		ErrorRev = "Y";
		/* True condition could send to Widget that displays this message */
		//this.PublishInfoMessage("Step:", Ice.Common.BusinessObjectMessageType.Error, Ice.Bpm.InfoMessageDisplayMode.Individual, string.Empty, string.Empty);
		return true;
		}
	return false;
	}
return false;
}
return false;
1 Like

Thanks work for me