We have employee expenses set up to be approved by the program manager via a Task Set. We now would like to have the employee’s supervisor approve the expense when the employee is the program manager. I have tried putting a BPM on the data directive for Task where I set the SalesRepCode to the supervisor instead of the PM but it isn’t working. It keeps getting overwritten with the PM. I made the task set and workflow groups inactive but then it doesn’t go to the PM - it only goes to the supervisor.
I swear it worked at one point with the BPM only (task set still active) but now it does not work at all. Here is my code:
var projectID = "";
var conProjMgr = "";
var conProjEng = "";
var empID = "";
foreach(var t in ttTask.Where(o=>o.RowMod == "A" && o.RelatedToFile == "EmpExpense" && o.CompletionAction == "Aprv")) {
projectID = Db.EmpExpense.Where(l=>l.Company == Session.CompanyID && l.SysRowID == t.RelatedToSysRowID).FirstOrDefault().ProjectID;
empID = Db.EmpExpense.Where(l=>l.Company == Session.CompanyID && l.SysRowID == t.RelatedToSysRowID).FirstOrDefault().EmpID;
if(!String.IsNullOrEmpty(projectID)) {
conProjMgr = Db.Project.Where(o=>o.ProjectID == projectID).FirstOrDefault().ConProjMgr;
if(!String.IsNullOrEmpty(conProjMgr))
{
if (empID == conProjMgr)
{
//go get this person's supervisor instead of letting them sign their own expense report
conProjMgr = Db.EmpBasic.Where(o=>o.EmpID == empID).FirstOrDefault().SupervisorID;
}
t.SalesRepCode = conProjMgr;
Db.Validate();
this.PublishInfoMessage(t.SalesRepCode.ToString(),Ice.Common.BusinessObjectMessageType.Information, Ice.Bpm.InfoMessageDisplayMode.Individual,"", "");
}
}
}