---
sourceDocument: Australia Enable AI
sourceDocumentLink: https://servicenow-prod.fluidtopics.net/r/pt-BR/intelligent-experiences

 Release :

    - australia

ft:locale :

    - pt-BR

ft:publication_title :

    - Australia Enable AI

ft:clusterId :

    - platai

bundleId :

    - platai

workflow :

    - Platform


---

# Use a script with Generative AI Controller

# Use a script with Generative AI Controller {#ariaid-title1}

* Versão de lançamento: Australia
* 
* Atualizado 12 de mar. de 2026
* 
* ![](https://www.servicenow.com/docs/portal-asset/ico-clock) 1 min. de leitura

Use background scripts and Generative AI Controller Generic Prompt to interact directly with the generative AI model API.

## Antes de Iniciar

You must be on Vancouver patch 2 or above to script with `sn_one_extend.OneExtendUtil` objects.

Role required: admin

## Procedimento

1. Navigate to AllSystem DefinitionScripts - Background.
2. Create the text content for a Generic Prompt by creating a `request` array with a singular `executionRequests` object.
3. Inside the `executionRequests`, add the `payload` and `capabilityID` attributes.  
   The `capabilityID` is the sys_id of the capability on the OneExtend Capabilities (sys_one_extend_capability) table, such as Generic Prompt.
4. Add the required inputs as attributes in the `payload` object.  
   {#script-with-generative-ai__entry__2}

   | Capability | Required attributes |
   |-|-|
   | Generic Prompt | prompt: Prompt for the generative AI to respond to. |
   | Generate Content | topic: Subject for content generation. |
   | Sentiment Analysis | utterance: Text to analyze for user sentiment. |
   | Summarize | textToSummarize: Topic for the AI to generate a summary. |
   [ ]

   The following is an example `request` array for the Generic Prompt capability.

       var request = {
          "executionRequests": [
           {
              "payload": {
                 "prompt": "Can you act like my business partner and give me some advice on a pitch?"
               },
               "capabilityId": "0c90ca79533121106b38ddeeff7b12d7"
            }
         ]
       };

5. Call the `execute` method on sn_one_extend.OneExtendUtil.
6. **Opcional:** To display the response after running the background script, print the response in readable JSON by using the following code:  

       gs.info(JSON.stringify(sn_one_extend.OneExtendUtil.execute(request)));


