The function sets the input parameter as syncArg:

1. Request Header (header) Function
Usefulness: When the request header of the other party's OA platform requires the integration platform to send an OA message, and each request needs to carry different parameters in the request header, this function can be used to implement
Function Example
String token = "The header data that needs to be returned"
return ["key":token] //return a map
Add Entry:

2. Request Body Function
Usefulness: When the request body of the other party's OA platform needs to do some special logic conversion, you can use this function to achieve
Add Entry: the same as the previous one.
Function Example
log.info("Before entering parameters: function input parameters of the integrated platform" + Fx.json.toJson(syncArg))
log.info("Before entering the parameter: " + syncArg)
Map syncArgAfter = [:]
String requestDataStr = syncArg["request_data"] as String;
Map requestData = Fx.json.parse(requestDataStr);
//requestData.put("taskId", (requestData["taskId"] as String)+(requestData["thirdReceiverId"]!=null? requestData["thirdReceiverId"] as String:""))//need to do The logic of some special parameter conversion
log.info("Conversion syncArg: " + requestData)
return ["request_data":requestData];//Fixed returned parameter format
3. url Function
Usefulness: When the request address of the other party's OA platform receives a request each time, it is required that the integration platform needs to carry different parameters on the url, which can be realized with the help of this function
Function Example
String url='';
return ["url":url] //Return a map with a fixed key as url
Add Entry:

4. Single Sign-on Function
Usefulness: When an account clicks on the agency message on the OA, for security verification, a security verification is generally performed with the other party's system to obtain the identity of the other party's OA account, so that the integrated platform can exchange the corresponding ShareCRM based on the OA account, so as to realize the function of free login
免登函数调用的前提
URL example https://www.fxiaoke.com/erp/syncdata/open/oa/authorize/common/#F028/#F037/#F015/false
The analysis corresponding to the url parameter: https://www.fxiaoke.com/erp/syncdata/open/oa/authorize/common/{ei}/{apiName}/{dataId}/{isApp}
({} is an explanation of the meaning of the placeholder above)

Function Example
String url = syncArg["oaConnectParam"]["ssoAuthUrl"] as String;
log.info("url:"+url)
String ticket = syncArg["params"]["requestParams"]["v5ticket"] as String;
log.info("ticket:"+ticket);
def(Boolean error,HttpResult data,String errorMessage) = Fx.http.get(url+ticket, null, 2000, true, 2, false);
log.info("data:"+data["content"] as String);
String content = data["content"] as String;
syncArg.put("oaUser", content.trim());//Fixed returns the third-party account whose key is oaUser
log.info("syncArg: "+Fx.json.toJson(syncArg));
return syncArg;
Add Entry:

5. General Single Sign-on Function
Scene: The account wants to add an application on the OA portal, click on the application to go to the main page of ShareCRM through the OAuth2.0 protocol without login
Step 1: The address of the application configuration is: https://www.fxiaoke.com/erp/syncdata/open/oa/authorize/common/login?ei=corresponding enterprise account id (pure number)
该地址可以后面自己拼接对应的参数
/**
* author: ajman
* Universal Binance
* */
log.info("syncArg:"+syncArg)//Analyze your own parameters. For example, the authentication parameter carried by the corresponding system is ticket
String userAgent = syncArg["params"]["headers"]["user-agent"] as String;
log.info("userAgent: "+userAgent)
String ticket = syncArg["params"]["ticket"] as String;
boolean isApp = syncArg["params"]["requestParams"]["isApp"] as Boolean;
log.info("url process ticket:"+ticket);
//ticket requests the authentication identity interface of the other party, and returns the corresponding erp personnel account. Supplement by yourself, fill the returned account into oaUser
//According to the parameters, request the OA platform to obtain the corresponding OAuser account
syncArg.put("oaUser", "oaUser, remember to replace");
String redirectUrl="";
if(isApp){
//Simple judgment whether it is a mobile terminal
redirectUrl='https://www.fxiaoke.com/XV/UI/Home#crm/index';
}else{
redirectUrl='https://www.fxiaoke.com/hcrm/dingtalk';
}
log.info("crm jump address: "+redirectUrl)
syncArg.put("redirectUrl", redirectUrl);//Need to return the specified address
log.info("syncArg: "+Fx.json.toJson(syncArg));
return syncArg;