首页 > 代码库 > 如何从流程表单录入抛单到组织机构

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

问题

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

 

解决办法

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

接口关键代码

var unit = 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.HandleResult result = 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);

 

                         }


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