---
sourceDocument: Xanadu API 참조
sourceDocumentLink: https://servicenow-prod.fluidtopics.net/r/ko-KR/xanadu/api-reference

 Release :

    - xanadu

ft:locale :

    - ko-KR

ft:publication_title :

    - Xanadu API 참조

ft:clusterId :

    - crapiref

bundleId :

    - crapiref

workflow :

    - Creator


---

# 플로우 - 범위 지정 됨(사용되지 않음)

# 플로우 - 범위 지정 됨(사용되지 않음) {#ariaid-title1}

* 릴리스 버전: Xanadu
* 
* 업데이트 날짜 2024년 08월 01일
* 
* ![](https://www.servicenow.com/docs/portal-asset/ico-clock) 소요 시간: 7분

플로우 API는 활성화 워크플로우 스튜디오 된 플로우를 실행하는 메서드를 제공합니다.

이 API는 더 이상 사용되지 않으며 및 [ScriptableFlowRunnerResult - 범위 지정됨](https://servicenow-prod.fluidtopics.net/nPh~Vdf0E8tKTdVBQ9vruQ#ScriptableFlowRunnerResultScopedAPI "ScriptableFlowRunner를 사용하여 플로우, 하위 플로우 또는 작업을 실행한 결과를 캡처합니다. 컨텍스트 ID, 도메인 및 플로우 실행의 출력과 같은 데이터를 포함합니다.")API로 [ScriptableFlowRunner - 범위 지정](https://servicenow-prod.fluidtopics.net/grg28cHKfMvl0f_I18mQRA#ScriptableFlowRunnerScopedAPI "플로우, 하위 플로우 및 작업 실행에 대한 매개변수를 정의하는 데 사용되는 빌더 객체를 생성합니다. 특정 도메인에서 실행할 플로우를 지정할 수 있습니다. 빌더에서 직접 플로우, 하위 플로우 또는 작업 실행을 시작하고 ScriptableFlowRunnerResult 객체에서 결과를 봅니다.") 대체됩니다.

플로우 API는 서버 스크립트에서만 사용할 수 있습니다.

`sn_fd` 네임스페이스를 사용하여 플로우 API에 액세스합니다.

플로우 API를 사용하여 플로우와 상호작용하기 전에 먼저 인터페이스에서 워크플로우 스튜디오 플로우를 생성하고 활성화해야 합니다. Flow API는 미리 빌드된 흐름과만 상호 작용하므로 클래스에 대한 생성자가 없습니다.  
주:  
인스턴스 성능을 최적화하려면 비동기 비즈니스 규칙 스크립트에서 이러한 메서드를 호출하지 마십시오. 대신 UI 내에서 워크플로우 스튜디오 예약된 작업 기록을 생성합니다.

## 흐름 - startAsync(String scopeName.flowName, map flowInputs) {#ariaid-title2}

트리거를 무시하고 활성화된 플로우를 비동기식으로 실행합니다.
비동기 호출은 비차단이므로 클라이언트가 흐름이 완료될 때까지 기다릴 필요 없이 스크립트에서 다른 코드를 실행할 수 있습니다.
{#FlowScoped-startAsync_S_GR__table_s1t_yn5_ncb__entry__3}

| 이름 | 유형 | 설명 |
|-|-|-|
| scopeName.flowName | 문자열 | 플로우의 애플리케이션 범위와 실행할 플로우의 내부 이름입니다. scopeName이 포함되지 않은 경우 현재 로그인한 사용자의 범위가 사용됩니다. 방문 페이지의 내부 이름 열을 워크플로우 스튜디오 사용하여 플로우의 내부 이름을 검색합니다. |
| flowInputs | 맵 | 기록 기반 플로우 입력을 정의하는 `<String, Object>` 형식의 이름-값 쌍입니다. 기록 기반 트리거로 플로우를 호출하려면 다음 형식을 사용합니다. var flowInputs = {}; flowInputs['current'] = glideRecord; flowInputs['table_name'] = glideRecord.getTableName(); GlideRecord 객체의 이름은 "현재"여야 합니다. 트리거를 사용하여 서비스 카탈로그 플로우를 호출하려면 다음 형식을 사용합니다. var flowInputs = {}; flowInputs['request_item'] = glideRecord; flowInputs['table_name'] = glideRecord.getTableName(); GlideRecord 객체의 이름은 "request_item"여야 합니다. |
[표 1. 매개변수]

{#FlowScoped-startAsync_S_GR__table_s1t_yn5_ncb} {#FlowScoped-startAsync_S_GR__table_t1t_yn5_ncb__entry__2}

| 유형 | 설명 |
|-|-|
| 객체 | PlanResponse 객체는 다음 속성을 포함합니다. * contextId: 실행된 플로우에 대한 실행 세부 정보 기록의 sys_id입니다. 에서 플로우 실행 탭 워크플로우 스튜디오 으로 이동하고 sys_id으로 필터링하여 실행 세부 정보에 액세스합니다. {#FlowScoped-startAsync_S_GR__ul_bd2_k2v_ncb} 플로우에서 다음과 같은 경우 예외가 발생합니다. * 지정된 애플리케이션 범위 내에 존재하지 않거나 플로우 또는 범위 이름의 철자가 잘못되었습니다. * 이(가) 활성화되지 않았습니다. * 시스템 속성에 의해 설정된 재귀 제한을 초과합니다 com.glide.hub.flow_engine.indirect_recursion_limit . 기본값은 3입니다. {#FlowScoped-startAsync_S_GR__ul_ub3_n3t_pcb} |
[표 2. 반환]

{#FlowScoped-startAsync_S_GR__table_t1t_yn5_ncb}  

    //Example 1: Run a flow with a record-based trigger
    (function startFlowAsync() {

    	try {
    		// You MUST fetch the GlideRecord that will be passed to the flow
    		var glideRecordInput = new GlideRecord('sys_user');
    		glideRecordInput.get('62826bf03710200044e0bfc8bcbe5df1');

    		var flowInputs = {};
    		flowInputs['current'] = glideRecordInput;
    		flowInputs['table_name'] = glideRecordInput.getTableName();

    		var result = sn_fd.Flow.startAsync('global.recordtriggeredflow', flowInputs);

    		//The Sys ID of a flow execution (contextId)
    		var contextId = result.contextId;

    	} catch (ex) {
    		var message = ex.getMessage();
    		gs.error(message);
    	}

    })();

    //Example 2: Run a flow with a schedule-based trigger
    (function startFlowAsync() {

    	try {
    		var result = sn_fd.Flow.startAsync('global.scheduletriggeredflow');

    		//The Sys ID of a flow execution (contextId)
    		var contextId = result.contextId;

    	} catch (ex) {
    		var message = ex.getMessage();
    		gs.error(message);
    	}

    })();

    //Example 3: Run a flow with a Service Catalog trigger
    (function startFlowAsync() {

    	try {
    		// You MUST fetch the GlideRecord that will be passed to the flow
    		var glideRecordInput = new GlideRecord('sc_req_item');
    		glideRecordInput.get(aeed229047801200e0ef563dbb9a71c2);

    		var flowInputs = {};
    		flowInputs['request_item'] = glideRecordInput;
    		flowInputs['table_name'] = glideRecordInput.getTableName();

    		var result = sn_fd.Flow.startAsync('global.catalogtriggeredflow', flowInputs);

    		//The Sys ID of a flow execution (contextId)
    		var contextId = result.contextId;

    	} catch (ex) {
    		var message = ex.getMessage();
    		gs.error(message);
    	}

    })();

    //Example 4: Run a flow with a MetricBase trigger
    (function startMetricBaseFlowAsync() {

    	try {

    		var oilLevelTriggerRecord = new GlideRecord('oil_levels');
    		oilLevelTriggerRecord.get('a4b3622bc72113007b237f48cb97635f');

    		var metricTriggerDefinition = new GlideRecord('sys_metric_trigger_definition');
    		metricTriggerDefinition.get('21f2eae7c72113007b237f48cb976352');

    		var event_time = oilLevelTriggerRecord.getValue('sys_created_on');
    		var level = 4;

    		var metricBaseFlowInputs = {};
    		//The record that triggered the metric event
    		metricBaseFlowInputs['current'] = oilLevelTriggerRecord;
    		//The MetricBase Trigger Definition record
    		metricBaseFlowInputs['metric'] = metricTriggerDefinition;
    		//The time that the 'record' reached a specific metric event level and triggered this flow
    		metricBaseFlowInputs['event_time'] = event_time;
    		//The target event level to reach in order for a metric flow to trigger
    		metricBaseFlowInputs['level'] = level;

    		var result = sn_fd.Flow.startAsync('global.metricbasedtriggeredflow', metricBaseFlowInputs);

    		//The Sys ID of a flow execution (contextId)
    		var contextId = result.contextId;

    	} catch (ex) {
    		var message = ex.getMessage();
    		gs.error(message);
    	}

    })();


