---
sourceDocument: Xanadu Enable AI
sourceDocumentLink: https://servicenow-prod.fluidtopics.net/r/xanadu/intelligent-experiences

 Release :

    - xanadu

ft:locale :

    - en-US

ft:publication_title :

    - Xanadu Enable AI

ft:clusterId :

    - platai

bundleId :

    - platai

workflow :

    - Platform


---

# Call a custom skill from a script

# Call a custom skill from a script {#ariaid-title1}

* Release version: Xanadu
* 
* Updated October 10, 2024
* 
* ![](https://www.servicenow.com/docs/portal-asset/ico-clock) 1 minute to read

You can use a script to call a custom skill.

## Before you begin

Role required: admin

## Procedure

1. Navigate to AllSystem UIUI Actions.
2. Create a UI action.  
   For more information on creating UI actions, see [Create a UI action](https://www.servicenow.com/docs/access?context=t_EditingAUIAction&version=xanadu&pubname=xanadu-platform-administration&ft:locale=en-US).
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);

**Related tasks**   

* [Create a skill](https://servicenow-prod.fluidtopics.net/aiaUWeusRmjY_MD7YGyvXw "Create a custom skill for Now Assist. Creating a custom skill enables you to have greater flexibility with Now Assist's generative AI capabilities.")
* [Create a prompt](https://servicenow-prod.fluidtopics.net/SSDxFo5kFjul3UUz8IhhyA "After you create a custom skill, create a prompt. Creating a prompt enables you to choose what skill inputs to use, as well as the type of tool.")
* [Use prompt assistance](https://servicenow-prod.fluidtopics.net/KMGqZ4xZUtc~pn5I4D5rRg "Use prompt assistance to get a jump start with your prompt development by selecting an example from the prompt library or using Now Assist to generate one.")
* [Test a prompt](https://servicenow-prod.fluidtopics.net/EJoQtcHIN9QQNOeyJDUOqA "After you create a prompt for your custom skill, test the prompt template before you finalize it. Testing the prompt verifies that you’re seeing the expected prompt results before it’s activated.")
* [Evaluate a prompt](https://servicenow-prod.fluidtopics.net/glGDrdcc7l5jJujGS0cc7w "Use the Now Assist Skill Kit evaluation tools to evaluate the effectiveness of your skill prompts.")
* [Finalize and publish a skill](https://servicenow-prod.fluidtopics.net/oH_qVLPPis~lX3b~cYn8kg "When you’re satisfied with your prompt, you can publish your custom skill. Publishing the skill enables a Now Assist admin to activate it.")
* [Activate a skill](https://servicenow-prod.fluidtopics.net/T2gjqog3Sh_Wx4YnuTl2Qg "After you create and publish a custom skill, you must activate it in Now Assist Admin. Activating the skill enables you to trigger the skill within the UI.")

*[\>]: and then


