Call a custom skill from a script

  • 릴리스 버전: Australia
  • 업데이트 날짜 2026년 03월 12일
  • 소요 시간: 1분
  • You can use a script to call a custom skill.

    시작하기 전에

    Role required: admin

    프로시저

    1. Navigate to All > System UI > UI Actions.
    2. Create a UI action.
      For more information on creating UI actions, see Create a UI action.
    3. Add your script.

      The following script is an example. You can replace the variables with your data.

      var inputsPayload = {};
      
      // create the payload to deliver input data to the skill
      
      inputsPayload[‘input name’] = {
      
        tableName: 'table name',
      
        sysId: 'sys_id',
      
        queryString: ''
      
      };
      
      
      //create the request by combining the capability sys ID and the skill config sys ID
      
      var request = {
      
          executionRequests: [{
      
              payload: inputsPayload,
      
              capabilityId: ‘capability sys id’,
      
              meta: {
      
                  skillConfigId: ‘skill config sys id’
      
              }
      
          }],
      
          mode: 'sync'
      
      };
      
      
      //run the custom skill and get the output in a string format
      try {
      var output = sn_one_extend.OneExtendUtil.execute(request)['capabilities'][request.executionRequests[0].capabilityId]['response'];
      var LLMOutput = JSON.parse(output).model_output;
      } catch(e) {
       gs.error(e);
       gs.addErrorMessage('Something went wrong while executing the skill.');
      }
      action.setRedirectURL(current);