Flowportal.Net BPM升级小计2

时间:2022-06-18
本文章向大家介绍Flowportal.Net BPM升级小计2,主要内容包括其使用实例、应用技巧、基本知识点总结和需要注意事项,具有一定的参考价值,需要的朋友可以参考一下。

上次BPM升级后,经过几天的使用,只发现了一个升级造成的问题,是在一个新员工招聘入职流程里写了一个C#的步骤来触发其他流程,下图是出错信息:

经过和厂商确认,把原来的写法:“process.CreateTask(owner,datasetPost).Step.Approve();”改写成如下格式后问题解决:BPMTask task = process.CreateTask(owner, datasetPost); task.Step.Approve();

附上完整的触发流程的C#代码,供大家参考

//把当前的流程保存到数据库
Context.Current.Task.SaveToDB();
if ((String)Context.Current.FormDataSet["FormEmployeeOnBoard.NeedTelephone"]=="Yes")
{
String CurrentUser = (String)Context.Current.FormDataSet["FormEmployeeOnBoard.Requester"];
Member owner = Member.FromAccount(CurrentUser);
//Member owner = Member.FromAccount("troy.cui");
BPMProcess process = BPMProcess.GetProcess("座机电话申请 - Request for Telephone");
FlowDataSet datasetPost = DataSourceManager.LoadDataSetSchema(process.GlobalTableIdentitys);
FlowDataTable table = datasetPost.Tables["FormTelephone"];
FlowDataRow row = table.NewRow();
table.Rows.Add(row);
row["EmployeeID"] =(String)Context.Current.FormDataSet["FormEmployeeOnBoard.EmployeeID"];
row["DepartmentName"] =(String)Context.Current.FormDataSet["FormEmployeeOnBoard.DepartmentName"];
row["ChineseName"] =(String)Context.Current.FormDataSet["FormEmployeeOnBoard.ChineseName"];
row["EnglishName"] =(String)Context.Current.FormDataSet["FormEmployeeOnBoard.EnglishName"];
row["PositionName"] =(String)Context.Current.FormDataSet["FormEmployeeOnBoard.PositionName"];
row["Office"] =(String)Context.Current.FormDataSet["FormEmployeeOnBoard.Office"];
row["LineManager"] =(String)Context.Current.FormDataSet["FormEmployeeOnBoard.LineManager"];
row["OnBoardDate"] =Context.Current.FormDataSet["FormEmployeeOnBoard.OnBoardDate"];
row["Requester"] =(String)Context.Current.FormDataSet["FormEmployeeOnBoard.Requester"];
row["RequestDate"] =(DateTime)Context.Current.FormDataSet["FormEmployeeOnBoard.RequestDate"];
row["Remark"] =(String)Context.Current.FormDataSet["FormEmployeeOnBoard.Remark"];
row["Status"] =(String)Context.Current.FormDataSet["FormEmployeeOnBoard.Status"];
//使用数据库默认时间
//row["TransDate"] =(DateTime)Context.Current.FormDataSet["FormEmployeeOnBoard.TransDate"];
row["TransIP"] =(String)Context.Current.FormDataSet["FormEmployeeOnBoard.TransIP"];
row["CreationUser"] =(String)Context.Current.FormDataSet["FormEmployeeOnBoard.CreationUser"];
row["LastUpdateIP"] =(String)Context.Current.FormDataSet["FormEmployeeOnBoard.LastUpdateIP"];
//使用数据库默认时间
//row["LastUpdateDate"] =(DateTime)Context.Current.FormDataSet["FormEmployeeOnBoard.LastUpdateDate"];
row["LastUpdateUser"] =(String)Context.Current.FormDataSet["FormEmployeeOnBoard.LastUpdateUser"];
//process.CreateTask(owner,datasetPost);
//自动审批通过第一步 3.5n
//process.CreateTask(owner,datasetPost).Step.Approve();
//自动审批通过第一步 3.5t
BPMTask task = process.CreateTask(owner, datasetPost);
task.Step.Approve();
}