Fx.stage

Fx.stage: Stage Booster API stage api

1. Trigger phase thrusters

Fx.stage.trigger(<String objectApiName>, <String objectId>, <String userId>)

Parameter Description

| parameter | type | description |
| ------------ | ------------ | ----------------------- ----------------------------------------- |
| objectApiName | String | API name of the object |
| objectId | String | object data id |
| userId | String | Initiator |

return type

APIResult

Return value description

Map
workflowInstanceId: process id of the currently triggered stage propeller
isCurrentDef: whether the current instance is the current definition
hasInstance: whether there is a process instance
stagePropellerName: stage propeller definition name
Return value reference
[false,{"workflowInstanceId":"631020344ffa3d4d730ebf3b"},""]
Note: The above is the unified return structure of the function, the first return value indicates whether the request failed , false means the request was successful

Java example

APIResult ret = Fx.stage.trigger("object_qep6N__c", "617f9b7340beec0001b9b14e","1007");
log. info(ret);
if (ret. isError()) {
  log.info(ret.message());
} else{
  log.info(ret.getData());
}

Groovy example

def(Boolean error, Map data, String errorMessage) = Fx.stage.trigger("object_qep6N__c", "617f9b7340beec0001b9b14e", "1007")
log. info(ret)
if (error) {
  log. info(errorMessage)
} else{
  log. info(data)
}

2. Match the stage booster that can be triggered (non-business opportunity 2.0)

Fx.stage.matchDef(<String entityId>, <String objectId>, <String userId>)

Parameter Description

| parameter | type | description |
| ------------ | ------------ | ----------------------- ----------------------------------------- |
| entityId | String | object apiName |
| objectId | String | data id |
| userId | String | user id |

return type

APIResult

Return value description

Map
sourceWorkflowId: definition id
isCurrentDef:Whether the current instance is the current definition
hasInstance: whether there is a process instance
stagePropellerName: stage propeller definition name
Return value reference
[false, {sourceWorkflowId=62fcad533149760001149c27, isCurrentDef=true, hasInstance=true, stagePropellerName=ln master-slave editor}, ]

Groovy example

def api_name = context.data.object_describe_api_name as String
def object_id = context.data._id as String
log.info(api_name + "," + object_id)
def match_result = Fx.stage.matchDef(api_name, object_id, "1000")
log. info(match_result)

3. Switch stage propeller (non-business opportunity 2.0)

Fx.stage.change(<String entityId>, <String objectId>, <String sourceWorkflowId>, <String stageId>, <String userId>)

Parameter Description

| parameter | type | description |
| ------------ | ------------ | ----------------------- ----------------------------------------- |
| entityId | String | object apiName |
| objectId | String | data id |
| sourceWorkflowId | String | The definition id of the stage booster obtained by pre-match, refer to Fx.stage.matchDef |
| stageId | String | initialization stage id |
| userId | String | user id |

return type

APIResult

Return value description

Map

Groovy example

def match_result = Fx.stage.change("object_qep6N__c", "617f9b7340beec0001b9b14e", "61a87f17bb3d4700017f5a78", "1", "1000")
log. info(match_result)

4. Update and complete the task

Fx.stage.changeTaskHandler(<String taskId>, <List candidateIds>, <String userId>)

Parameter Description

| parameter | type | description |
| ------------ | ------------ | ----------------------- ----------------------------------------- |
| taskId | String | |
| candidateIds | List | list of handles to replace|
| userId | String | user id |

return type

APIResult

Return value description

Map

Groovy example

def rst = Fx.stage.changeTaskHandler("6343ff9e80f4841c79cbcb5c", ["1000"], "1106")
log. info(rst)

5. Complete the task associated with the selection

Fx.stage.completeCreateAndRelatedTask(<String taskId>, <String entityId>, <String objectId>, <String userId>)

Parameter Description

| parameter | type | description |
| ------------ | ------------ | ----------------------- ----------------------------------------- |
| taskId | String | |
| entityId | String | object apiName |
| objectId | String | data id |
| userId | String | |

return type

APIResult

Return value description

Map

Groovy example

def rst = Fx.stage.completeCreateAndRelatedTask("6343ff9e80f4841c79cbcb5c", "object_qep6N__c", "617f9b7340beec0001b9b14e", "1106")
log. info(rst)

6. Update and complete the task

Fx.stage.updateAndCompleteTask(<String taskId>, <Map data>, <String userId>)

Parameter Description

| parameter | type | description |
| ------------ | ------------ | ----------------------- ----------------------------------------- |
| taskId | String | |
| data | Map | data information to be updated |
| userId | String | user id |

return type

APIResult

Return value description

Map

Groovy example

def data = ["name": "value"]
def rst = Fx.stage.updateAndCompleteTask("6343ff9e80f4841c79cbcb5c", data, "1001")
log. info(rst)

7. Reactivation

Fx.stage.reactive(<String workflowInstanceId>, <String activeStageId>, <Map data>, <String userId>)

Parameter Description

| parameter | type | description |
| ------------ | ------------ | ----------------------- ----------------------------------------- |
| workflowInstanceId | String | Process instance Id |
| activeStageId | String | active stage |
| data | Map | update form data |
| userId | String | user id |

return type

APIResult

Return value description

Map

Groovy example

//Reactivate the function demo
// instance id
def workflowInstanceId="62c3da4e0d9f997b27dfd90e"
// stage to jump to
def activeStageId="47u3S02Gz"
//reactivate form filling
Map data= ["field_0mvhC__c": "90"]
def userId = "1000"
def(boolean error, Map result, String message) = Fx.stage.reactive(workflowInstanceId, activeStageId, data, userId)
if (error) {
  log.info("error :" + message)
} else {
  log. info(result)
}

8. Reactivate validation

Fx.stage.reactiveValidate(<String workflowInstanceId>, <String userId>)

Parameter Description

| parameter | type | description |
| ------------ | ------------ | ----------------------- ----------------------------------------- |
| workflowInstanceId | String | Process instance Id |
| userId | String | user id |

return type

APIResult

Return value description

Map

Groovy example

//Reactivate the verification function interface demo
// instance id
def workflowInstanceId = "62c3da4e0d9f997b27dfd90e"
def userId = context. userId
def(boolean error, Map result, String message) = Fx.stage.reactiveValidate(workflowInstanceId, userId)
if (error) {
  log.info("error: " + message)
} else {
  log. info(result)
}

2022-11-23
0 0