Forwarding a single-row GlideRecord object

When forwarding a single row of data from a GlideRecord object, store the sys_id of that row on the scratchpad.

In this example, the sending activity instantiates a GlideRecord object from a passed Incident Number. The activity then updates the Short description of that incident and adds the sys_id of the incident to the scratchpad.

    // assume that 'incidentNumber' comes from a workflow input variable, activity variable, or other source.
 
    // read the row into a glide record.
    var grIncident = new GlideRecord('incident');
    grIncident.get('number', incidentNumber);
    grIncident.short_description = 'IMPORTANT: needs attention');
    grIncident.update();
 
    // write this row to the scratchpad for the next acivity:
    workflow.scratchpad.incidentId = gr.getUniqueValue();

The follow-up activity then uses the sys_id value passed in the workflow.scratchpad.incidentId scratchpad variable to instantiate a new GlideRecord object for that row.

    // re-read the incident in the follow-up activity:
    var grIncident = new GlideRecord('incident');
    grIncident.get( workflow.scratchpad.incidentId );