Published at: 2025-10-30

1.1 [CRM Task OA] OA Functions


Function parameters are uniformly set as syncArg:

picture coming soon:

1. Modify Requests

(1) New Version Function: Modify Header, URL, and Body to Directly Execute OA Requests

``` log.info(“Input parameters before: Integration Platform function input” + Fx.json.toJson(syncArg)) log.info(“Input parameters before: “ + syncArg) String requestDataStr = syncArg[“requestData”] as String; //Request body

Map requestData = Fx.json.parse(requestDataStr); requestData.put(“remark”, “Test 111”) log.info(“Converted syncArg: “ + requestData) String urldata = syncArg[“url”] as String; //Request URL (can return dynamic URLs)

Map headerMap = syncArg[“header”] as Map; headerMap.put(“external”, “test”); //Return header

// Call OA API and retrieve response

Map result = [“code”:200, “message”:”success”] //When directly executing OA requests within this function, this parameter must be returned. Do not return it in other scenarios.

return [“requestData”:requestData, “header”:headerMap, “url”:urldata, “result”:result]; //Fixed return parameter format ```

Entry point:
picture coming soon:

(2) Header Function (Deprecated - Refer to New Version Function)

Purpose: When the target OA platform requires the Integration Platform to send OA messages with unique headers per request, use this function.

``` Function example

String token = “Header data to return”

return [“key”:token] //Return a map ```

Entry point:
picture coming soon:

(3) Request Body Function (Deprecated - Refer to New Version Function)

Purpose: When the target OA platform requires special logic transformations in the request body.

Entry point: Same as above.

``` Function example

log.info(“Input parameters before: Integration Platform function input” + Fx.json.toJson(syncArg)) log.info(“Input parameters before: “ + 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:””)) //Special parameter conversion logic

log.info(“Converted syncArg: “ + requestData)

return [“request_data”:requestData]; //Fixed return parameter format————This function is deprecated. Refer to the new version function. ```

(4) URL Function (Deprecated - Refer to New Version Function)

Purpose: When the target OA platform requires unique URL parameters per request from the Integration Platform.

``` Function example

log.info(syncArg)

String url=syncArg.url; //Get original URL from Integration Platform //todo Implement token retrieval logic for your enterprise, then concatenate with the above URL

return [“url”:url] //Return a map with fixed key “url” ```

Entry point: Currently no UI configuration for URL function. Contact developers for built-in implementation.

2. Single Sign-On (SSO) from Task Notifications to CRM

Purpose: When users click task notifications in OA, security validation typically requires verifying their OA account identity with the target system. The Integration Platform can then map the OA account to the corresponding ShareCRM account for SSO.

Prerequisite for SSO Function
When configuring OA scenario parameters in the Integration Platform (body parameter settings), you must use a fixed URL format. Otherwise, the unified SSO function cannot be invoked.

URL example: https://www.fxiaoke.com/erp/syncdata/open/oa/authorize/common/#F028/#F037/#F015/false URL parameter breakdown: https://www.fxiaoke.com/erp/syncdata/open/oa/authorize/common/{ei}/{apiName}/{dataId}/{isApp} ({} explains placeholder meanings)

picture coming soon:

``` 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 return with “oaUser” as key for third-party account

log.info(“syncArg:”+Fx.json.toJson(syncArg));

return syncArg; ```

Entry point:
picture coming soon:

3. SSO from External Portals to CRM

Scenario: Customers want to add an application on their OA portal that enables SSO to ShareCRM’s main page via OAuth 2.0 protocol.

Step 1: Configure the application with this URL: https://www.fxiaoke.com/erp/syncdata/open/oa/authorize/common/login?ei=corresponding enterprise ID (numeric only)

Note
You can append additional parameters to this URL.

``` Code example:

/** * author:ajman * Universal SSO * */ log.info(“syncArg:”+syncArg) //Parse your parameters. For example, if the system carries authentication parameter “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 flow ticket:”+ticket);

//Request target system’s authentication API with ticket to get corresponding ERP account. Implement this logic and populate oaUser

//Get OA user account by calling OA platform with parameters. Returning only oaUser defaults to ShareCRM homepage. syncArg.put(“oaUser”,”oaUser, replace this”);

String redirectUrl=””; if(isApp){ //Simple mobile detection redirectUrl=’https://www.fxiaoke.com/XV/UI/Home#crm/index’; }else{ redirectUrl=’https://www.fxiaoke.com/hcrm/avah5’; //Requires new framework homepage }

log.info(“CRM redirect URL:”+redirectUrl) syncArg.put(“redirectUrl”,redirectUrl); //Must return specified URL log.info(“syncArg:”+Fx.json.toJson(syncArg));

return syncArg; ```

Submit Feedback