Example 5: Delete a record in an external source

  • Rversion finale: Australia
  • Mis à jour 12 mars 2026
  • 1 minute de lecture
  • In this example, we create a script to delete an incident record from the external source.

    (function executeDelete(v_record) {
    
         var gr = new GlideRecord('incident');
         if (gr.get(v_record.sys_id)) {
             gr.deleteRecord();
         } else {
             v_record.setLastErrorMessage("Record not found");
         }
     })(v_record);