天翎MyApps技术社区 - 低代码平台 | 流程管理系统 | BPM软件

 找回密码
 注册成为天翎用户
查看: 3321|回复: 0

[微信企业号] 任务自动从企业域组织架构同步到微信企业号组织架构【 任务 同步 组织架构 通讯录】

[复制链接]
andy1 发表于 2016-9-26 11:37:51 | 显示全部楼层 |阅读模式
关于自动从企业微信上同步组织结构到企业域,可以把以下脚本放到定时任务里去。
  1. (function(){
  2.         var process = getDomainProcess();
  3.         var idomainid ="11e5-554d-af5bcda9-89b0-59d0040f3e7b";
  4.         var idomainvo = process.doView(idomainid);
  5.         return  process.synch2Weixin(idomainvo);
  6. })();
复制代码


参考源码:
  1. /**
  2.          * 从企业微信上同步组织结构到企业域
  3.          * @return
  4.          */
  5.         public String doSynch2Weixin(){
  6.                 ParamsTable params = getParams();
  7.                 String domainId = params.getParameterAsString("domainId");
  8.                 try {
  9.                         DomainVO vo = (DomainVO) process.doView(domainId);
  10.                         JSONObject result = ((DomainProcess)process).synch2Weixin(vo);
  11.                         Map<String, String> request = (Map) ActionContext.getContext().get("request");
  12.                         request.put("result", result.toString());
  13.                         this.addActionMessage("同步成功");
  14.                 } catch (OBPMValidateException e) {
  15.                         this.addFieldError("1", e.getValidateMessage() != null ? e.getValidateMessage() : "同步失败");
  16.                         return INPUT;
  17.                 } catch (Exception e) {
  18.                         this.setRuntimeException(new OBPMRuntimeException("{*[OBPMRuntimeException]*}",e));
  19.                         e.printStackTrace();
  20.                         return INPUT;
  21.                 }
  22.                
  23.                 return SUCCESS;
  24.         }
复制代码
QQ截图20160926113629.png

本版积分规则

QQ|手机版|天翎MyApps技术社区 ( 粤ICP备11093750号 )

GMT+8, 2026-8-12 03:59

Powered by Discuz! X3.4

Copyright © 2001-2020, Tencent Cloud.

快速回复 返回顶部 返回列表