카탈로그 항목 구성요소에 대한 샘플 코드

  • 릴리스 버전: Australia
  • 업데이트 날짜 2026년 03월 12일
  • 소요 시간: 3분
  • 이벤트가 트리거될 때 작업을 정의하기 위해 샘플 코드가 제공됩니다. 웹 페이지에 구성요소를 포함하기 전에 사용 사례에 대한 샘플 코드를 업데이트합니다.

    샘플 코드

    { 
    
    'SN_EMBEDX_CATALOG_ITEM_FORM#COMPONENT_NOTIFICATION_SENT' : (e) => { 
    
    // This event is dispatched when the component provides a notification for the end user. 
    
    var {items} = e.detail.payload; 
    
    console.log(items); 
    
    }, 
    
    'SN_EMBEDX_CATALOG_ITEM_FORM#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_CATALOG_ITEM_FORM#RECORD_CREATION_SUCCEEDED' : (e) => { 
    
    // This event is dispatched if the record was successfully created. 
    
    var {table, record_sys_id} = e.detail.payload; 
    
    console.log(table, record_sys_id); 
    
    }, 
    
    'SN_EMBEDX_CATALOG_ITEM_FORM#BUTTON_CLICKED' : (e) => { 
    
    // This event is dispatched if any button is clicked on the confirmation message. 
    
    var {table, record_sys_id, button_variant} = e.detail.payload; 
    
    var primaryURL = '/caseview'; // Replace with the URL of the case view page 
    
    var secondaryURL = '/browse'; // Replace with the URL of the secondary page 
    
     
    
    if(button_variant == 'primary') { 
    
    // Construct the URL for the Case View component with URL parameters 
    
    const caseViewURL = primaryURL+'?emb_table='+table+'&emb_recordid='+record_sys_id; 
    
    open(caseViewURL,'_self'); // Open case record when primary button is clicked 
    
    } 
    
    else { 
    
    // Open the Case View component in the same tab 
    
    open(secondaryURL,'_self'); 
    
    } 
    
    }, 
    
    'SN_EMBEDX_CATALOG_ITEM_FORM#RECORD_CREATION_FAILED' : (e) => { 
    
    // This event is dispatched if the record creation has failed. 
    
    }, 
    
    'SN_EMBEDX_CATALOG_ITEM_FORM#COMPONENT_READY' : (e) => { 
    
    // This event is dispatched when a component is ready and usable. 
    
    }