ScriptableFlowRunner - 범위 지정
플로우, 하위 플로우 및 작업 실행에 대한 매개변수를 정의하는 데 사용되는 빌더 객체를 생성합니다. 특정 도메인에서 실행할 플로우를 지정할 수 있습니다. 빌더에서 직접 플로우, 하위 플로우 또는 작업 실행을 시작하고 ScriptableFlowRunnerResult 객체에서 결과를 봅니다.
sn_fd 네임스페이스 식별자와 함께 서버 측 스크립트에서 이러한 메서드를 사용합니다.
API 호출 순서
다음 순서로 이러한 API를 사용하여 플로우, 하위 플로우 및 작업을 빌드하고 실행합니다.
- 1. FlowAPI: 빌더 객체 생성
- getRunner()를 사용하여 ScriptableFlowRunner 빌더 객체를 인스턴스화합니다.
- 2. ScriptableFlowRunner: 실행할 콘텐츠 지정 워크플로우 스튜디오
- 다음 순서대로 다음 메서드를 사용하여 빌더 패턴을 생성합니다.
- action(),datastream(),flow() 또는 subflow() 메서드 중 하나를 사용하여 빌드할 객체 유형을 워크플로우 스튜디오 지정합니다.
- addInput(),inDomain() 또는 quick()과 같은 하나 이상의 메서드를 사용하여 실행 매개 변수를 지정합니다.
- run() 메서드를 사용하여 제공된 매개변수로 작업, 플로우 또는 하위 플로우를 실행하고 ScriptableFlowRunnerResult 객체를 반환합니다.
- 3. ScriptableFlowRunnerResult: 실행 상세 정보 검색 워크플로우 스튜디오
- getContextId(), getOutputs() 및 getDomainId()와 같은 하나 이상의 메서드를 사용하여 실행 상세 정보를 봅니다.
예제
이 예제에서는 ScriptableFlowRunner 빌더 객체를 생성하고 이를 사용하여 특정 기록에 대한 승인 작업을 실행하는 방법을 보여줍니다. ScriptableFlowRunnerResult 객체는 실행 인수와 작업 출력을 캡처합니다.
(function() {
try {
var inputs = {};
inputs['sys_id'] = '57af7aec73d423002728660c4cf6a71c'; // Pass the record's sys_id in as input.
var result = sn_fd.FlowAPI.getRunner() // Create a ScriptableFlowRunner builder object.
.action('global.markapproved') // Run the global scope action named markapproved.
.inForeground()
.inDomain('TOP/ACME') // Run the action from the TOP/ACME domain.
.withInputs(inputs)
.run(); // Run the action and return a FlowRunnerResult object.
var contextId = result.getContextId(); // Retrieve the context ID from the result
var dateRun = result.getDate();
var domainUsed = result.getDomainId(); // Retrieve the Domain ID from the result.
var flowName = result.getFlowObjectName();
var flowObjectType = result.getFlowObjectType();
var outputs = result.getOutputs(); // Retrieve any outputs from the action execution.
var newApprovalStatus = outputs['approval']; // Echo back the approval status for verification.
} catch (ex) {
var message = ex.getMessage();
gs.error(message);
}
})();
ScriptableFlowRunner - action(String scopedActionName)
실행할 작업의 범위와 이름을 식별합니다.
| 이름 | 유형 | 설명 |
|---|---|---|
| scopedActionName | 문자열 | 실행할 작업의 범위 및 이름입니다. 예 : global.actionName. |
| 유형 | 설명 |
|---|---|
| ScriptableFlowRunner | 작업, 플로우 또는 하위 플로우를 실행하는 데 사용되는 작성기 객체입니다 워크플로우 스튜디오 . |
이 예제에서는 ScriptableFlowRunner 빌더 객체를 생성하고 이를 사용하여 특정 기록에 대한 승인 작업을 실행하는 방법을 보여줍니다. ScriptableFlowRunnerResult 객체는 실행 인수와 작업 출력을 캡처합니다.
(function() {
try {
var inputs = {};
inputs['sys_id'] = '57af7aec73d423002728660c4cf6a71c'; // Pass the record's sys_id in as input.
var result = sn_fd.FlowAPI.getRunner() // Create a ScriptableFlowRunner builder object.
.action('global.markapproved') // Run the global scope action named markapproved.
.inForeground()
.inDomain('TOP/ACME') // Run the action from the TOP/ACME domain.
.withInputs(inputs)
.run(); // Run the action and return a FlowRunnerResult object.
var contextId = result.getContextId(); // Retrieve the context ID from the result
var dateRun = result.getDate();
var domainUsed = result.getDomainId(); // Retrieve the Domain ID from the result.
var flowName = result.getFlowObjectName();
var flowObjectType = result.getFlowObjectType();
var outputs = result.getOutputs(); // Retrieve any outputs from the action execution.
var newApprovalStatus = outputs['approval']; // Echo back the approval status for verification.
} catch (ex) {
var message = ex.getMessage();
gs.error(message);
}
})();
ScriptableFlowRunner - addInput(문자열 이름, 객체 값)
단일 입력을 추가합니다. 인수로 전달된 이름이 이미 별도의 입력으로 존재하는 경우 새 값이 기존 값을 대체합니다.
이 메서드는 단일 입력을 추가합니다. 객체를 만들고 여러 입력을 추가하려면 withInputs() 메서드를 사용합니다.
| 이름 | 유형 | 설명 |
|---|---|---|
| 이름 | 문자열 | 플로우, 하위 플로우 또는 작업에 대한 입력의 이름입니다. |
| 값 | 객체 | 플로우, 하위 플로우 또는 작업에 대한 입력 값입니다. |
| 유형 | 설명 |
|---|---|
| ScriptableFlowRunner | 작업, 플로우 또는 하위 플로우를 실행하는 데 사용되는 작성기 객체입니다 워크플로우 스튜디오 . |
이 예제에서는 table_name라는 단일 입력을 사용하는 작업을 실행합니다.
(function() {
try {
var result = sn_fd.FlowAPI.getRunner()
.action('global.test_action')
.addInput('table_name', 'incident')
.inForeground()
.run();
gs.info(result.debug());
} catch (ex) {
var message = ex.getMessage();
gs.error(message);
}
})();
출력:
Flow Designer: TableName
*** Script: FlowRunnerResult
Flow Object Name: global.test_action
Flow Object Type: action
Domain: null
Result Time: 2020-06-09 00:10:57
ContextId: null
Output count: 1
ScriptableFlowRunner - asUser()
빠른 백그라운드 실행을 위해 시스템이 아닌 트리거한 사용자로 플로우를 실행합니다.
asUser() 메서드와 함께 quick()을 사용하여 플로우를 트리거하면 플로우를 트리거한 사용자가 검색되어 플로우 실행에 사용됩니다.
| 이름 | 유형 | 설명 |
|---|---|---|
| 없음 |
| 유형 | 설명 |
|---|---|
| ScriptableFlowRunner - 범위 지정 | 작업, 플로우 또는 하위 플로우를 실행하는 데 사용되는 작성기 객체입니다 워크플로우 스튜디오 . |
(function() {
try {
var outputs = sn_fd.FlowAPI.getRunner() // Create a ScriptableFlowRunner builder object.
.flow('global.stry53225960_flow_asuser_test')
.inForeground()
.quick() //Run the flow from a server-side script.
.asUser() //Run flow with the roles specified in the flow.
.run(); // Run the action and return a FlowRunnerResult object.
} catch (ex) {
var message = ex.getMessage();
gs.error(message);
}
})();오류
- asUser()를 quick()과 함께 사용하지 않으면 스크립트가 오류를 반환합니다.
- 역할이 정의된 플로우에서 asUser() 를 호출하면 스크립트가 오류를 반환합니다.
- withRoles() 및 asUser() 메서드가 동시에 호출되면 스크립트가 오류를 반환합니다.
ScriptableFlowRunner - datastream(String scopedDatastreamName)
실행할 데이터 스트림 작업의 범위와 이름을 식별합니다.
데이터 스트림 작업에 대한 자세한 내용은 데이터 스트림 작업 및 페이지 매김을 참조하세요.
| 이름 | 유형 | 설명 |
|---|---|---|
| scopedDatastreamName | 문자열 | 실행할 데이터 스트림 작업의 범위 및 이름입니다. 예: global.dataStreamActionName. |
| 유형 | 설명 |
|---|---|
| ScriptableFlowRunner | 작업, 플로우 또는 하위 플로우를 실행하는 데 사용되는 작성기 객체입니다 워크플로우 스튜디오 . |
이 예제에서는 데이터 스트림 작업을 실행하는 방법을 보여 줍니다.
(function() {
try {
var result = sn_fd.FlowAPI.getRunner()
.datastream('global.test_dsa')
.inForeground()
.run();
gs.info(result.debug());
} catch (ex) {
var message = ex.getMessage();
gs.error(message);
}
})();
출력:
*** Script: FlowRunnerResult
Flow Object Name: global.test_dsa
Flow Object Type: datastream
Domain: null
Result Time: 2020-06-08 16:41:13
ContextId: null
Output count: 0
ScriptableFlowRunner - flow(문자열 scopedFlowName)
실행할 플로우의 범위와 이름을 식별합니다.
| 이름 | 유형 | 설명 |
|---|---|---|
| scopedFlowName입니다. | 문자열 | 실행할 플로우의 범위 및 이름입니다. 예: global.flowName. |
| 유형 | 설명 |
|---|---|
| ScriptableFlowRunner | 작업, 플로우 또는 하위 플로우를 실행하는 데 사용되는 작성기 객체입니다 워크플로우 스튜디오 . |
이 예제에서는 메시지를 기록하는 흐름을 실행하는 방법을 보여 줍니다.
(function() {
try {
var result = sn_fd.FlowAPI.getRunner()
.flow('global.test_flow')
.inForeground()
.run();
gs.info(result.debug());
} catch (ex) {
var message = ex.getMessage();
gs.error(message);
}
})();
출력:
*** Script: FlowRunnerResult
Flow Object Name: global.test_flow
Flow Object Type: flow
Domain: null
Result Time: 2020-06-08 16:41:13
ContextId: null
Output count: 0
ScriptableFlowRunner - inBackground()
플로우, 하위 플로우 또는 작업을 비동기식으로 실행합니다. 플로우 객체가 실행되기 시작하면 스크립트 실행이 즉시 재개됩니다.
| 이름 | 유형 | 설명 |
|---|---|---|
| 없음 |
| 유형 | 설명 |
|---|---|
| ScriptableFlowRunner | 작업, 플로우 또는 하위 플로우를 실행하는 데 사용되는 작성기 객체입니다 워크플로우 스튜디오 . |
이 예는 백그라운드에서 비동기적으로 플로우를 실행하는 방법을 보여줍니다.
(function() {
try {
var result = sn_fd.FlowAPI.getRunner()
.flow('global.change__unauthorized__review')
.inBackground()
.run();
gs.info(result.debug());
} catch (ex) {
var message = ex.getMessage();
gs.error(message);
}
})();
출력:
[0:00:01.015] Script completed in scope global: script
––––––––––––––––––––––––––––––––––––––––––––––––––––--
Script execution history and recovery available here
Operation Table Row Count
insert sys_flow_context_inputs_chunk 1
insert sys_flow_context 1
––––––––––––––––––––––––––––––––––––––––––––––––––––--
Complex type redefined: FlowDesigner:FDCollection
Queued flow.fire event in NowMQ for sys_flow_context.sys_id: e0cd6e30b8b602104a8752ad4a9167c8,
sysevent.sys_id: 34cd6e30dbb60210497c1a48139619c9, with priority 5
*** Script: FlowRunnerResult
Flow Object Name: global.change__unauthorized__review
Flow Object Type: flow
Domain: null
Result Time: 2024-06-12 17:54:58
ContextId: e0cd6e30b8b602104a8752ad4a9167c8
Output count: 0
ScriptableFlowRunner - inDomain(String domainId)
지정된 도메인에서 플로우, 하위 플로우 또는 작업을 실행합니다. 도메인이 존재하고 사용할 수 있는지 확인합니다.
| 이름 | 유형 | 설명 |
|---|---|---|
| domainId | 문자열 | 플로우의 실행 도메인에 대한 sys_id 또는 이름입니다. |
| 유형 | 설명 |
|---|---|
| ScriptableFlowRunner | 작업, 플로우 또는 하위 플로우를 실행하는 데 사용되는 작성기 객체입니다 워크플로우 스튜디오 . |
이 예제에서는 ScriptableFlowRunner 빌더 객체를 생성하고 이를 사용하여 특정 기록에 대한 승인 작업을 실행하는 방법을 보여줍니다. ScriptableFlowRunnerResult 객체는 실행 인수와 작업 출력을 캡처합니다.
(function() {
try {
var inputs = {};
inputs['sys_id'] = '57af7aec73d423002728660c4cf6a71c'; // Pass the record's sys_id in as input.
var result = sn_fd.FlowAPI.getRunner() // Create a ScriptableFlowRunner builder object.
.action('global.markapproved') // Run the global scope action named markapproved.
.inForeground()
.inDomain('TOP/ACME') // Run the action from the TOP/ACME domain.
.withInputs(inputs)
.run(); // Run the action and return a FlowRunnerResult object.
var contextId = result.getContextId(); // Retrieve the context ID from the result
var dateRun = result.getDate();
var domainUsed = result.getDomainId(); // Retrieve the Domain ID from the result.
var flowName = result.getFlowObjectName();
var flowObjectType = result.getFlowObjectType();
var outputs = result.getOutputs(); // Retrieve any outputs from the action execution.
var newApprovalStatus = outputs['approval']; // Echo back the approval status for verification.
} catch (ex) {
var message = ex.getMessage();
gs.error(message);
}
})();
ScriptableFlowRunner - inForeground()
플로우, 하위 플로우 또는 작업을 동기식으로 실행합니다. 플로우 객체가 실행되는 동안 스크립트 실행이 일시 중지됩니다.
| 이름 | 유형 | 설명 |
|---|---|---|
| 없음 |
| 유형 | 설명 |
|---|---|
| ScriptableFlowRunner | 작업, 플로우 또는 하위 플로우를 실행하는 데 사용되는 작성기 객체입니다 워크플로우 스튜디오 . |
이 예제에서는 ScriptableFlowRunner 빌더 객체를 생성하고 이를 사용하여 특정 기록에 대한 승인 작업을 실행하는 방법을 보여줍니다. ScriptableFlowRunnerResult 객체는 실행 인수와 작업 출력을 캡처합니다.
(function() {
try {
var inputs = {};
inputs['sys_id'] = '57af7aec73d423002728660c4cf6a71c'; // Pass the record's sys_id in as input.
var result = sn_fd.FlowAPI.getRunner() // Create a ScriptableFlowRunner builder object.
.action('global.markapproved') // Run the global scope action named markapproved.
.inForeground()
.inDomain('TOP/ACME') // Run the action from the TOP/ACME domain.
.withInputs(inputs)
.run(); // Run the action and return a FlowRunnerResult object.
var contextId = result.getContextId(); // Retrieve the context ID from the result
var dateRun = result.getDate();
var domainUsed = result.getDomainId(); // Retrieve the Domain ID from the result.
var flowName = result.getFlowObjectName();
var flowObjectType = result.getFlowObjectType();
var outputs = result.getOutputs(); // Retrieve any outputs from the action execution.
var newApprovalStatus = outputs['approval']; // Echo back the approval status for verification.
} catch (ex) {
var message = ex.getMessage();
gs.error(message);
}
})();
ScriptableFlowRunner - quick()
실행 세부 정보 또는 기타 관련 기록을 만들지 않고 서버 측 스크립트에서 플로우, 하위 플로우, 작업 또는 데이터 스트림 작업을 동기식 또는 비동기식으로 실행합니다. 기록 보관 오버헤드를 제거하여 성능을 향상시킵니다. 이 API를 사용하여 프로덕션 환경에서 대용량 처리(예: 초당 여러 실행)의 속도를 높입니다.
- 보고 및 기록 생성됨
- 이 메서드는 설정에 관계없이 워크플로우 스튜디오 실행 세부 정보 및 컨텍스트 기록을 생성하지 않습니다.
- 대기 조건 지원
- 이 메서드는 조건을 기다리기 위해 작업 또는 플로우를 일시 중지하는 것을 지원하지 않습니다. 승인 요청, 조건 대기 또는 기간 대기와 같은 대기 조건으로 일시 중지되는 작업, 플로우 논리 및 단계는 지원되지 않습니다.
- MID Server 지원
- 이 방법은 MID 서버에서 실행할 작업 또는 플로우의 일시 중지를 지원하지 않습니다. 이 제한에는 MID 서버에서 실행할 작업을 일시 중지하는 데이터 스트림 작업 전처리 스크립트가 포함됩니다.
- 데이터 스트림 작업 지원
- 이 메서드는 MID 서버에서 전처리 스크립트를 실행하기 위해 데이터 스트림 작업을 일시 중지하는 것을 지원하지 않습니다.
- 플로우 우선순위 지원
- 이 메서드는 플로우 우선순위 설정을 지원합니다. 지정된 플로우 우선순위에 따라 플로우가 실행됩니다.
| 이름 | 유형 | 설명 |
|---|---|---|
| 없음 |
| 유형 | 설명 |
|---|---|
| ScriptableFlowRunner | 작업, 플로우 또는 하위 플로우를 실행하는 데 사용되는 작성기 객체입니다 워크플로우 스튜디오 . |
이 예는 관련 기록을 생성하지 않고 플로우를 실행하는 방법을 보여줍니다.
(function() {
try {
var result = sn_fd.FlowAPI.getRunner()
.flow('global.change__unauthorized__review')
.inBackground()
.quick()
.run();
gs.info(result.debug());
} catch (ex) {
var message = ex.getMessage();
gs.error(message);
}
})();
출력:
Complex type redefined: FlowDesigner:FDCollection
Queued flow.run.quick event in NowMQ for sys_flow_context.sys_id: d81781ec57801110403e8f90ac94f90e,
sysevent.sys_id: 48abe270dbf20210497c1a4813961908, with priority 5
*** Script: FlowRunnerResult
Flow Object Name: global.change__unauthorized__review
Flow Object Type: flow
Domain: null
Result Time: 2024-06-12 17:45:37
ContextId: 08abe2706cf202107b7d3b283f7ee108
Output count: 0
ScriptableFlowRunner - run()
지정된 매개변수를 사용하여 플로우, 하위 플로우 또는 작업을 실행합니다.
| 이름 | 유형 | 설명 |
|---|---|---|
| 없음 |
| 유형 | 설명 |
|---|---|
| ScriptableFlowRunnerResultsScoped | 작업, 플로우 또는 하위 플로우의 실행 상세 정보를 포함하는 객체입니다 워크플로우 스튜디오 . |
이 예제에서는 ScriptableFlowRunner 빌더 객체를 생성하고 이를 사용하여 특정 기록에 대한 승인 작업을 실행하는 방법을 보여줍니다. ScriptableFlowRunnerResult 객체는 실행 인수와 작업 출력을 캡처합니다.
(function() {
try {
var inputs = {};
inputs['sys_id'] = '57af7aec73d423002728660c4cf6a71c'; // Pass the record's sys_id in as input.
var result = sn_fd.FlowAPI.getRunner() // Create a ScriptableFlowRunner builder object.
.action('global.markapproved') // Run the global scope action named markapproved.
.inForeground()
.inDomain('TOP/ACME') // Run the action from the TOP/ACME domain.
.withInputs(inputs)
.run(); // Run the action and return a FlowRunnerResult object.
var contextId = result.getContextId(); // Retrieve the context ID from the result
var dateRun = result.getDate();
var domainUsed = result.getDomainId(); // Retrieve the Domain ID from the result.
var flowName = result.getFlowObjectName();
var flowObjectType = result.getFlowObjectType();
var outputs = result.getOutputs(); // Retrieve any outputs from the action execution.
var newApprovalStatus = outputs['approval']; // Echo back the approval status for verification.
} catch (ex) {
var message = ex.getMessage();
gs.error(message);
}
})();
ScriptableFlowRunner - subflow(문자열 scopedSubflowName)
실행할 하위 플로우의 범위와 이름을 식별합니다.
| 이름 | 유형 | 설명 |
|---|---|---|
| scopedSubflowName | 문자열 | 실행할 하위 플로우의 범위 및 이름입니다. 예 : global.subflowName. |
| 유형 | 설명 |
|---|---|
| ScriptableFlowRunner | 작업, 플로우 또는 하위 플로우를 실행하는 데 사용되는 작성기 객체입니다 워크플로우 스튜디오 . |
이 예시에서는 메시지를 기록하는 하위 플로우를 실행하는 방법을 보여줍니다.
(function() {
try {
var result = sn_fd.FlowAPI.getRunner()
.subflow('global.output_test')
.inForeground()
.run();
gs.info(result.debug());
} catch (ex) {
var message = ex.getMessage();
gs.error(message);
}
})();
출력:
record-watcher asynchronous tracking complete - time: 1 ms. Executed responders: 1
record-watcher asynchronous tracking complete - time: 1 ms. Executed responders: 1
*** Script: FlowRunnerResult
Flow Object Name: global.output_test
Flow Object Type: subflow
Domain: null
Result Time: 2024-08-02 22:52:08
ContextId: b2dxx659bebf01101d72200x503x19pr
Output count: 2
ScriptableFlowRunner - 시간 초과(번호 시간 초과)
플로우, 하위 플로우 또는 작업 실행에 대한 시간 제한을 설정합니다.
| 이름 | 유형 | 설명 |
|---|---|---|
| 시간 제한 | 번호 | 시간 제한(밀리초)입니다. |
| 유형 | 설명 |
|---|---|
| ScriptableFlowRunner | 작업, 플로우 또는 하위 플로우를 실행하는 데 사용되는 작성기 객체입니다 워크플로우 스튜디오 . |
이 예제에서는 흐름을 실행하고 제한 시간을 2분으로 설정하는 방법을 보여줍니다.
(function() {
try {
var result = sn_fd.FlowAPI.getRunner()
.flow('global.test_flow')
.inForeground()
.timeout(120000)
.run();
gs.info(result.debug());
} catch (ex) {
var message = ex.getMessage();
gs.error(message);
}
})();
출력:
Flow Designer: Cloning a new session to run as as user id: [user_name] from original user session: [user_name]
Flow Designer: Reverting cloned session to original user session: [user_name]
*** Script: FlowRunnerResult
Flow Object Name: global.test_flow
Flow Object Type: flow
Domain: null
Result Time: 2020-06-08 18:22:35
ContextId: null
Output count: 0
ScriptableFlowRunner - validateInputs(부울 validateInputs)
오류를 발생시키고 메서드 입력에 예기치 않은 값이 있는 경우 ScriptableFlowRunner 클래스가 실행되지 않도록 합니다. 이 메서드의 기본값은 모든 ScriptableFlowRunner 호출입니다.
| 이름 | 유형 | 설명 |
|---|---|---|
| validateInputs | 부울 | ScriptableFlowRunner 메서드 입력의 유효성을 검사할지 여부를 나타내는 플래그입니다. 유효한 값은 두 가지입니다.
기본값: True |
| 유형 | 설명 |
|---|---|
| 없음 |
이 예제에서는 메서드 입력 값의 유효성을 검사하지 않고 흐름을 실행하는 방법을 보여줍니다.
(function() {
try {
var result = sn_fd.FlowAPI.getRunner()
.flow('global.test_flow')
.inForeground()
.validateInputs(false)
.run();
gs.info(result.debug());
} catch (ex) {
var message = ex.getMessage();
gs.error(message);
}
})();
출력:
*** Script: FlowRunnerResult
Flow Object Name: global.test_flow
Flow Object Type: flow
Domain: null
Result Time: 2020-06-08 16:41:13
ContextId: null
Output count: 0
ScriptableFlowRunner - withConnectionAliasOverride(String aliasName, String overrideName)
플로우, 작업 또는 하위 플로우와 연결 및 자격 증명 연결된 별칭을 재정의합니다. 기본 상위 별칭을 하위 별칭으로 재정의할 수 있습니다.
별칭 재정의 연결 및 자격 증명 에 대한 자세한 내용은 여러 연결 지원을 참조하세요.
| 이름 | 유형 | 설명 |
|---|---|---|
| parentAliasSysID | 문자열 | 상위 별칭의 sys_id, 재정의하려는 별칭입니다. |
| overrideAliasSysID | 문자열 | 하위 별칭의 sys_id로, 플로우, 하위 플로우 또는 작업을 실행할 때 사용하려는 별칭입니다. |
| 유형 | 설명 |
|---|---|
| ScriptableFlowRunner | 작업, 플로우 또는 하위 플로우를 실행하는 데 사용되는 작성기 객체입니다 워크플로우 스튜디오 . |
이 예시에서는 플로우에 연결된 기본값이 아닌 다른 별칭을 사용하여 플로우를 실행하는 방법을 보여줍니다.
(function() {
try {
var result = sn_fd.FlowAPI.getRunner()
.flow('global.test_flow')
.withConnectionAliasOverride('sn_original_alias.spoke', 'x_new_alias.spoke')
.inForeground()
.run();
gs.info(result.debug());
} catch (ex) {
var message = ex.getMessage();
gs.error(message);
}
})();
ScriptableFlowRunner - withInputs(입력 매핑)
입력 컬렉션을 추가합니다. 이름-값 쌍 중 하나의 이름이 이미 있는 경우, 새 값이 기존 값을 대체합니다.
| 이름 | 유형 | 설명 |
|---|---|---|
| 입력 | 객체 | 플로우, 하위 플로우 또는 작업에 대한 입력을 정의하는 이름-값 쌍을 포함하는 객체입니다. |
| 유형 | 설명 |
|---|---|
| ScriptableFlowRunner | 작업, 플로우 또는 하위 플로우를 실행하는 데 사용되는 작성기 객체입니다 워크플로우 스튜디오 . |
입력 객체를 만들고 값을 withInputs() 메서드에 전달합니다.
(function() {
try {
var inputs = {};
inputs['sys_id'] = '57af7aec73d423002728660c4cf6a71c'; // Pass the record's sys_id in as input.
var result = sn_fd.FlowAPI.getRunner() // Create a ScriptableFlowRunner builder object.
.action('global.markapproved') // Run the global scope action named markapproved.
.inForeground()
.inDomain('TOP/ACME') // Run the action from the TOP/ACME domain.
.withInputs(inputs)
.run(); // Run the action and return a FlowRunnerResult object.
var contextId = result.getContextId(); // Retrieve the context ID from the result
var dateRun = result.getDate();
var domainUsed = result.getDomainId(); // Retrieve the Domain ID from the result.
var flowName = result.getFlowObjectName();
var flowObjectType = result.getFlowObjectType();
var outputs = result.getOutputs(); // Retrieve any outputs from the action execution.
var newApprovalStatus = outputs['approval']; // Echo back the approval status for verification.
} catch (ex) {
var message = ex.getMessage();
gs.error(message);
}
})();
ScriptableFlowRunner - withRoles()
플로우를 트리거한 사용자로 플로우를 실행하거나 에 추가된 워크플로우 스튜디오역할로 플로우를 실행합니다.
withRoles() 메서드와 함께 quick()을 사용하여 플로우를 트리거하면 플로우 속성에 정의된 역할이 검색되어 플로우 실행 중에 전달되고 플로우가 역할과 함께 실행됩니다.
| 이름 | 유형 | 설명 |
|---|---|---|
| 없음 |
| 유형 | 설명 |
|---|---|
| ScriptableFlowRunner - 범위 지정 | 작업, 플로우 또는 하위 플로우를 실행하는 데 사용되는 작성기 객체입니다 워크플로우 스튜디오 . |
(function() {
try {
var outputs = sn_fd.FlowAPI.getRunner() // Create a ScriptableFlowRunner builder object.
.flow('global.stry53225960_flow')
.inForeground()
.quick() //Run the flow from a server-side script.
.withRoles() //Run the flow as the user who triggered the flow.
.run(); // Run the action and return a FlowRunnerResult object.
} catch (ex) {
var message = ex.getMessage();
gs.error(message);
}
})();오류
- withRoles() 는 quick()과 함께 사용되지 않으면 작업을 수행하지 않습니다.
- 스크립트는 역할이 없는 플로우에서 withRoles() 가 호출되면 오류를 반환합니다.
- withRoles() 및 asUser() 메서드가 동시에 호출되면 스크립트가 오류를 반환합니다.