如何从流程表单录入抛单到组织机构

问题:

新建一个新的用户,可通过表单录入该用户的信息,在流程审批后,如何用代码实现将表单抛到组织机构里?

解决办法:

首先你要表单上要如下信息:1、所属的上级部门 2、登录名 3、姓名

接口关键代码

varunit = new OThinker.Organization.User()

{

ObjectID= Guid.NewGuid().ToString(),

  Code = code,//登录名

CompanyID=OThinker.H3.WorkSheet.AppUtility.Engine.Organization.Company.CompanyID,

 Name = name,//姓名

ParentID= parentCode,//所属组织,h3组织架构id

 // Sort Key

SortKey= j,

                     // 类型

CategoryID= null,

                     Appellation =row.GetCell(5).ToString().Trim(),

 };

  // 写入服务器

OThinker.Organization.HandleResultresult = OThinker.Organization.HandleResult.SUCCESS;

if(OThinker.H3.WorkSheet.AppUtility.Engine.Organization.GetUserByEmployeeNumber(code)!= null)

 {

result= OThinker.H3.WorkSheet.AppUtility.Engine.Organization.UpdateUnit(null, unit);

}

else

{

result= OThinker.H3.WorkSheet.AppUtility.Engine.Organization.AddUnit(null, unit);

  }

原文地址:https://www.cnblogs.com/1774bpm/p/6296126.html