---
sourceDocument: Yokohama Administração da Now Platform
sourceDocumentLink: https://servicenow-prod.fluidtopics.net/r/pt-BR/yokohama/platform-administration

 Release :

    - yokohama

ft:locale :

    - pt-BR

ft:publication_title :

    - Yokohama Administração da Now Platform

ft:clusterId :

    - platadm

bundleId :

    - platadm

workflow :

    - Platform


---

# Scripts de amostra da regra de negócios de eventos de mudança

# Scripts de amostra da regra de negócios de eventos de mudança {#ariaid-title1}

* Versão de lançamento: Yokohama
* 
* Atualizado 30 de jan. de 2025
* 
* ![](https://www.servicenow.com/docs/portal-asset/ico-clock) 1 min. de leitura

Vários scripts são encontrados na regra de negócios de eventos de mudança de linha de base.
Esta regra de negócio define eventos que são acionados após uma solicitação de mudança ser inserida ou atualizada.  

    if (current.operation() == 'insert') {
     gs.eventQueue("change.inserted", current, gs.getUserID(), gs.getUserName());
    }
     
    if (current.operation() == 'update') {
     gs.eventQueue("change.updated", current, gs.getUserID(), gs.getUserName());
    }
     
    if (!current.assigned_to.nil() && current.assigned_to.changes()) {
      gs.eventQueue("change.assigned", current, current.assigned_to.getDisplayValue() , previous.assigned_to.getDisplayValue());
    }
     
    if (current.priority.changes() && current.priority == 1) {
      gs.eventQueue("change.priority.1", current, current.priority, previous.priority);
    }
     
    if (current.risk.changes() && current.risk== 1) {
      gs.eventQueue("change.risk.1", current, current.risk, previous.risk); 
    }
     
    if (current.start_date.changes() || current.end_date.changes() || current.assigned_to.changes()) {  
      if (!current.start_date.nil() && !current.end_date.nil() && !current.assigned_to.nil()) {
        gs.eventQueue("change.calendar.notify", current, current.assigned_to, previous.assigned_to);
      }
     
      // Remove from previous assigned to, due to assigned_to changing
      if (!previous.assigned_to.nil()) {
          if (!current.assigned_to.nil() && current.assigned_to.changes() && 
             (!previous.start_date.nil() && !previous.end_date.nil())) {      
            gs.eventQueue("change.calendar.notify.remove", current, current.assigned_to, previous.assigned_to);
          }
       }
      // Remove old calendar from current assigned to, due to date changing
      else if (!current.assigned_to.nil()) {
         if ((current.start_date.changes() && !previous.start_date.nil()) || 
             (current.end_date.changes() && !previous.end_date.nil())) {
           gs.eventQueue("change.calendar.notify.remove", current, current.assigned_to, current.assigned_to);
         } 
      }
    }


