케이스 뷰 구성요소 인스턴스 구성

  • 릴리스 버전: Australia
  • 업데이트 날짜 2026년 03월 12일
  • 소요 시간: 10분
  • 사용자가 웹 사이트에 임베드하여 웹 사이트의 케이스 관련 활동에 직접 액세스할 수 있도록 케이스 뷰 구성요소 인스턴스를 구성합니다.

    시작하기 전에

    케이스 뷰 구성요소 인스턴스를 구성하려면 다음 설정이 있어야 합니다.

    필요한 역할: sn_embeddable_core.emb_admin

    프로시저

    1. 다음으로 이동 모두 > Web Embeddable > 홈페이지.
    2. 홈페이지에서 모듈 만들기를 선택하거나 기존 모듈을 사용합니다.
      새 모듈 생성에 대한 자세한 내용은 다음 문서를 참조하십시오 모듈 생성.
    3. 모듈 페이지의 구성요소 탭에서 케이스 뷰 구성요소 인스턴스를 기존 또는 새 그룹에 추가합니다.
      그룹을 만든 다음 구성 요소 인스턴스를 추가하는 방법에 대한 자세한 내용은 을 참조하십시오 그룹 생성 및 구성요소 인스턴스 추가.
    4. 옵션: 실시간 미리 보기를 사용할 수 없는 경우 구성요소의 시각적 표현을 보려면 정적 미리 보기 표시 옵션을 전환하십시오.
      주:
      활성화하면 전역 속성 또는 구성요소 속성에 대한 변경 사항이 미리 보기 탭에 실시간으로 표시되지 않습니다.
    5. 케이스 뷰 구성요소 인스턴스 속성을 구성합니다.
      • 미리 보기 탭에는 구성요소 속성에 설정된 선택 항목에 따라 실시간 데이터가 표시됩니다.
      • 케이스 뷰 구성요소 인스턴스와 관련된 구성요소 속성에 대한 설명은 다음 문서를 참조하십시오 케이스 뷰의 구성요소 속성.
    6. CORS 규칙 탭을 선택하여 CORS 규칙을 구성합니다.
      CORS 규칙 구성에 대한 자세한 내용은 다음 문서를 참조하십시오 구성요소를 포함 ServiceNow 하기 전에 CORS(Cross-Origin Resource Sharing) 규칙 구성.
    7. 구성요소 탭을 선택합니다.
      애플리케이션 범위에 대한 메시지가 나타나면 범위를 고객 서비스용 웹 구성 요소로 변경하여 기록을 편집할 수 있도록 합니다.
    8. Embed 코드 가져오기를 선택합니다.
      전역 코드와 구성요소 코드가 모두 표시되는 팝업 창이 나타납니다.
    9. 전역 코드 탭에서 생성된 코드를 검토하고 전역 코드 복사를 선택합니다.
      전역 코드는 외부 공급업체 웹 페이지에 한 번만 추가해야 합니다.
      import { init, login, logout, startGuestSession } from 'https://demo.servicenow.com/uxasset/externals/sn_embeddable_core/index.jsdbx';
      
      await init({
          theme: 'fad87d2ca304121029a4d1aed31e610f',  /* sys_id of the theme to use for the embeddable components in your website */
          baseURL: 'https://demo.servicenow.com', /* Base URL of the instance to be used for the embeddable components in your website */
          authCallback: getTokenCallBack, /* Function which returns the auth token for the current user, required for auth setup */
          module: '591800ffc1243610f87714367ed47c6a', /* Demo module */
          pageName: document.title, /* Uses the browser's document title as the page name in User analytics experience */
          guestTokenCallback: getGuestJWTTokenCallBack, /* Function which returns the guest token for the current user, required for guest validation setup */
          cacheComponents: [] /* Pre-caches resources for improved performance. Update component list as per your usage */
      });
      
      function getTokenCallBack() {
          var idToken; /* Get the id token for the current user */
          return Promise.resolve(idToken);
      }
      
      function getGuestJWTTokenCallBack() {
          var guestToken; /* Get the guest token for the current user */
          return Promise.resolve(guestToken);
      }
      
      /* Uncomment below function to handle guest session */
      // await startGuestSession();
      
      /* Uncomment below functions to handle login and logout once the user logs into your website */
      // await login();
      // await logout();
      
    10. 옵션: 구성 요소 코드 탭에서 이벤트 처리기 사용 토글 스위치를 밀어 웹 페이지의 사용자 상호 작용에 의해 트리거되는 이벤트를 처리합니다.
      주:
      이벤트 핸들러를 활성화하면 구성요소 코드도 수정됩니다. 의 이벤트 핸들러 Web Embeddables에 대한 자세한 내용은 다음 문서를 참조하십시오 향상된 케이스 뷰 구성요소의 이벤트 핸들러.
    11. 구성요소 코드 탭에서 생성된 코드를 검토하고 구성요소 코드 복사를 선택합니다.
      이 생성된 코드에는 이벤트 처리기에 대한 구성도 포함됩니다.
      <!--  
          Module: Demo module
          Group: Group 1
          Instance: Case view 1
      -->
      <sn-embedx-case-view
      	table="sn_customerservice_case"
      	table-view-for-related-list="4006fee3d7600200e5982cf65e6103de"
      	header-configuration-id="1db45f9118520210f8775b8843daf927"
      	action-configuration-id="b226535518520210f8775b8843daf9fb"
      	playbook-stage-orientation="horizontal"
      	visible-horizontal-playbook-stages="5"
      	playbook-activity-view-mode="focused"
      	sys-id="aa5ca024d7700200e5982cf65e61030e">
      </sn-embedx-case-view>
      <!--
       The component also includes the following additional properties:
       hide-activity
       hide-attachments
       hide-actions
       hide-all-related-lists
       show-custom-tab
       hide-errors
       hide-playbook-process-tab
       selected-playbook-context-id
       selected-stage-context-id
       selected-activity-context-id
       hide-playbook-stages
      -->
      
      <script type="module">
      	import { getEmbeddables, setEvents, setProperties } from 'https://demo.servicenow.com/uxasset/externals/sn_embeddable_core/index.jsdbx';
      	
      	const snEmbedxCaseView = document.querySelector('sn-embedx-case-view');
      
      	/* Uncomment this code for the default behaviour of the Case View component.
      
      	// Get the record id and table from the current URL for a standard case.
      	// Optionally, get playbook experience ID, playbook context ID, stage context ID,
      	// and activity context ID for playbook case.
      	const currentURL = new URL(window.location.href);
      	const urlParams = new URLSearchParams(currentURL.search);
      	const tableName = urlParams.get('emb_table');
      	const sysRecordId = urlParams.get('emb_recordid');
      	const playbookExperience = urlParams.get('emb_playbook_experience');
      	const playbookContextId = urlParams.get('emb_playbook_context_id');
      	const stageContextId = urlParams.get('emb_stage_context_id');
      	const activityContextId = urlParams.get('emb_activity_context_id');
      
      	// Update the sysId and table properties of the componentProperties object.
      	// Optionally, update the playbook experience ID, playbook context ID,
      	// stage context ID, and activity context ID for the playbook case view as well.
      	setProperties(snEmbedxCaseView,{
      		table:tableName,
      		sysId:sysRecordId,
      		playbookExperience:playbookExperience,
      		selectedPlaybookContextId:playbookContextId,
      		selectedStageContextId:stageContextId,
      		selectedActivityContextId:activityContextId
      	});
      	*/
      
      	getEmbeddables(["sn-embedx-case-view"]);
      
      	const eventHandlers = {
      		'SN_EMBEDX_CASE_VIEW#COMPONENT_READY' : (e) => {
      			// This event is dispatched when a component is ready and usable.
      		},
      		'SN_EMBEDX_CASE_VIEW#COMPONENT_ERROR' : (e) => {
      			// This event is dispatched when a property validation or internal error occurs.
      			var {errorMessage, errorType} = e.detail.payload;
      			console.log(errorMessage, errorType);
      		},
      		'SN_EMBEDX_CASE_VIEW#CASE_COMMENT_ADDED' : (e) => {
      			// This event is dispatched when a comment is added in the activity stream.
      		}
      	};
      
      	setEvents(snEmbedxCaseView, eventHandlers);
      </script>
      

    결과

    전역 및 구성요소 코드를 외부 공급업체 관리자와 공유하여 외부 공급업체 웹 사이트에 케이스 뷰 구성요소 인스턴스를 포함할 수 있습니다.

    다음에 수행할 작업

    외부 공급업체 웹 사이트에 케이스 뷰 구성요소 인스턴스 포함