The UniversalRequestUtilsSNC API enables handling universal request lifecycles. Provided as a script include record.

This API requires the Universal Request (com.snc.universal_request) plugin and is provided within the sn_uni_req namespace.

For information, refer to Universal Request.

UniversalRequestUtilsSNC - createUniversalRequest(Object copyFields)

Creates a universal request and returns the sys_id of the newly created universal request record.

This method is called using the UniversalRequestUtils prototype in the sn_uni_req namespace. For example, sn_uni_req.UniversalRequestUtils().createUniversalRequest(<copyFields>).

Table 2. Returns
Type Description
String Sys_id of the newly created universal request record.

Example

The following example shows how to set fields on a new universal request. In this use case, this code is added to the beginning of the Inbound Email Actions [sysevent_in_email_action] scoped Create HR Case script. If the case doesn't apply to HR, agents can transfer the case to the appropriate department.

var copiedFields = {
  'opened_for': "<user_sys_id>",    
  'short_description': email.subject,
  'restricted': false,
  'priority': '1'
};

// createUniversalRequest() must be called to create the universal request prior to creating the child case

var ur = new sn_uni_req.UniversalRequestUtils().createUniversalRequest(copiedFields);
current.universal_request = ur;