GlideRecord - setNewGuid()

Generates a new GUID and sets it as the unique id for the current record. This function applies only to new records. The GUID for an existing record cannot be changed

Table 1. Parameters
Name Type Description
None
Table 2. Returns
Type Description
void

var tsk_id = task.setNewGuid();
 
task.description = "Request: " + current.request.number;
task.description = task.description + "\n" + "Requested by: " + current.request.u_requested_by.name;
task.description = task.description + "\n" + "Requested for: " + current.request.u_requested_for.name;
task.description = task.description + "\n" + "Item: " + current.cat_item.name;
 
var gr = new GlideRecord ('task_rel_task');
//link the incident to the request (may need to review if it needs to be the item)
gr.parent = current.request;
gr.child = tsk_id;
gr.insert();