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 - 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 - subflow(string, scopedSubflowName)
실행할 하위 플로우의 범위와 이름을 식별합니다.
| 이름 | 유형 | 설명 |
|---|---|---|
| scopedSubflowName | 문자열 | 실행할 하위 플로우의 범위와 이름입니다. 예: global.subflowName. |
| 유형 | 설명 |
|---|---|
| ScriptableFlowRunner | 작업, 플로우 또는 하위 플로우를 실행하는 데 사용되는 빌더 객체입니다 플로우 디자이너 . |
(function() {
try {
var result = sn_fd.FlowAPI.getRunner()
.subflow('global.test_subflow')
.inForeground()
.run();
gs.info(result);
} 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: Message to log
Flow Designer: Reverting cloned session to original user session: [user_name]
*** Script: FlowRunnerResult
Flow Object Name: global.test_subflow
Flow Object Type: flow
Domain: null
Result Time: 2020-06-08 16:41:13
ContextId: null
Output count: 0
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(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 - inBackground()
플로우, 하위 플로우 또는 작업을 비동기식으로 실행합니다. 플로우 객체가 실행되기 시작하면 스크립트 실행이 즉시 다시 시작됩니다.
| 이름 | 유형 | 설명 |
|---|---|---|
| 없음 |
| 유형 | 설명 |
|---|---|
| ScriptableFlowRunner | 작업, 플로우 또는 하위 플로우를 실행하는 데 사용되는 빌더 객체입니다 플로우 디자이너 . |
이 예시에서는 플로우를 비동기식으로 실행하는 방법을 보여줍니다.
(function() {
try {
var result = sn_fd.FlowAPI.getRunner()
.flow('global.test_flow')
.inBackground()
.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: Message to log
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 16:41:13
ContextId: null
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 Server에서 실행할 작업 또는 플로우의 일시 중지를 지원하지 않습니다. 이 제한사항에는 MID Server에서 실행할 작업을 일시 중지하는 데이터 스트림 작업 전처리 스크립트가 포함됩니다.
- 데이터 스트림 작업 지원
- 이 메서드는 MID Server에서 전처리 스크립트를 실행하기 위해 데이터 스트림 동작을 일시 중지하는 것을 지원하지 않습니다.
| 이름 | 유형 | 설명 |
|---|---|---|
| 없음 |
| 유형 | 설명 |
|---|---|
| ScriptableFlowRunner | 작업, 플로우 또는 하위 플로우를 실행하는 데 사용되는 빌더 객체입니다 플로우 디자이너 . |
이 예시에서는 관련 기록을 생성하지 않고 플로우를 실행하는 방법을 보여줍니다.
(function() {
try {
var result = sn_fd.FlowAPI.getRunner()
.flow('global.test_flow')
.inForeground()
.quick()
.run();
gs.info(result);
} catch (ex) {
var message = ex.getMessage();
gs.error(message);
}
})();
출력:
Flow Designer: Message to log.
*** Script: [object FlowRunnerResult]
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 - timeout(Number timeout)
플로우, 하위 플로우 또는 작업 실행에 대한 시간 제한을 설정합니다.
| 이름 | 유형 | 설명 |
|---|---|---|
| 시간 제한 | 번호 | 시간 제한(밀리초)입니다. |
| 유형 | 설명 |
|---|---|
| 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 호출에 대해 기본적으로 true로 설정됩니다.
| 이름 | 유형 | 설명 |
|---|---|---|
| 인풋 검증 | 부울 | 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(문자열 aliasName, 문자열 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() 메서드가 동시에 호출되면 스크립트에서 오류를 반환합니다.