---
sourceDocument: Australia Employee Service Management
sourceDocumentLink: https://servicenow-prod.fluidtopics.net/r/pt-BR/employee-service-management

 Release :

    - australia

ft:locale :

    - pt-BR

ft:publication_title :

    - Australia Employee Service Management

ft:clusterId :

    - emplsm

bundleId :

    - emplsm

workflow :

    - Employee


---

# Response scripts

# Response scripts {#ariaid-title1}

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

Use response scripts to automatically take actions based on user responses to survey
questions. Response scripts can be used to create or update records across any of the Emergency Response Management and Safe Workplace suite apps.  
Each response script is associated with a survey. The response script runs if a user completes the associated survey and their answers match the response criteria.  
Nota:  
The [Employee Readiness Surveys](https://servicenow-prod.fluidtopics.net/ZiF~UcpwCIpJ3C8wdGEZ7g "The ServiceNow Employee Readiness Surveys application lets you evaluate the readiness of your workforce to return to the workplace by asking users to complete a survey.") app must be installed to use response scripts.

## Included response scripts {#ariaid-title2}

Emergency Outreach provides the pre-built Request PPE response
script.
The Request PPE response script requires the [Workplace PPE Inventory Management](https://servicenow-prod.fluidtopics.net/NsXe5c1SJzi4NJY5lFezdQ "Use the ServiceNow Workplace Personal Protective Equipment Inventory Management application to manage PPE inventory to help safeguard the physical safety  of your workforce. Monitor the availability of PPE at different locations, fulfill employee requests for PPE, and track PPE assigned to employees.") app. This
response script creates a PPE request for employees who complete the Employee workplace
readiness survey and meet the response criteria for the health status, travel, and ready to
return to the workplace questions.

The Request PPE response script is not active by default and must be manually activated. It
is ready to activate without any modifications, but you can choose to edit the script to
meet your company's needs. To activate the Request PPE response script, navigate to Emergency OutreachResponse Scripts and click the Request PPE record. Select the Active
check box, then click Update.

If you need to perform additional actions based on survey responses, you can create
additional response scripts. Use the included Request PPE response script as an example to
help create your own response scripts.

## Create a response script {#ariaid-title3}

Create a response script to automatically create or update records based on user
responses to survey questions.

### Antes de Iniciar

Role required: sn_imt_checkin.checkin_admin

### Por Que e Quando Desempenhar Esta Tarefa

Response scripts can be used to create or update records across any of the Emergency Response Management and Safe Workplace suite apps.
For example, you could create a response script to reserve a workspace for a user
who is ready to return to the workplace.

### Procedimento

1. Navigate to AllEmergency OutreachResponse Scripts and click New.
2. On the form, fill in the fields.  
   {#create-response-script__table_w5l_152_nmb__entry__2}

   | Field | Description |
   |-|-|
   | Active | Selected. |
   | Name | Name of the script. |
   | Survey | Survey that causes the script to run. When a survey instance is completed by a user, the script runs if the user's responses to the survey questions match the response criteria. |
   | Script | Script to insert or update a record. The script should perform the following steps. * Get the sys_id for the user who submitted the survey. var userSysId = userGr.getUniqueValue(); Nota: The `userGr` variable is defined in the Run Response Scripts action. This action is used by the Response Script Actions flow, which runs the response scripts when a user completes a survey and fulfills the response criteria. The `userGr` variable is a user GlideRecord, so you can use it to get additional fields from the user as needed. For example, `userGr.getValue('location')` gets the user's location. * If the plugin that installs the table you want to write to is active, insert or update a record for the user. Nota: The following code is provided as an example only. You must provide the correct plugin, table, and field names in your script, and make any additional modifications that you require. //example code to insert a record if (GlidePluginManager.isActive('plugin_name')) { var now_GR = new GlideRecord('table_name'); now_GR.initialize(); now_GR.user_field = userSysId; now_GR.field = 'value'; //update additional fields here as needed now_GR.insert(); } //example code to update an existing record associated with the user if (GlidePluginManager.isActive('plugin_name')) { var now_GR = new GlideRecord('table_name'); now_GR.get('user_field', userSysId); now_GR.field_to_update = 'value'; //update additional fields here as needed now_GR.update(); } //example code to update multiple existing records associated with the user if (GlidePluginManager.isActive('plugin_name')) { var now_GR = new GlideRecord('table_name'); now_GR.addQuery('user_field', userSysId); now_GR.setValue('field_to_update', 'value'); //update additional fields here as needed now_GR.updateMultiple(); } {#create-response-script__ul_dmr_hy2_nmb} |
   [Tabela 1. Response script form]

   {#create-response-script__table_w5l_152_nmb}
3. Save the response script record using the form context menu.  
   The Response Criteria related list is automatically populated with all questions from the associated survey.
4. Edit the response criteria to define the answers a user must provide for the response script to run.
   1. Define the required answer in the response criteria for relevant questions.
   2. Delete the response criteria for any questions that don't require a specific answer.
   {#create-response-script__substeps_zfc_vrf_nmb}
5. Click Update.

