{"revision":"c10276e953456835cdbb1f3a60d58ae1980be353","document":{"id":939,"path":"api-reference/server-api-reference/UniversalRequestUtilsSNCScopedAPI.md","title":"UniversalRequestUtilsSNC - Scoped","bundle":null,"doc_type":null,"release":"australia","body":"\n# UniversalRequestUtilsSNC- Scoped\n\nThe UniversalRequestUtilsSNC API enables handling universal request life cycles. Provided as a script include record.\n\nThis API requires the Universal Request \\(com.snc.universal\\_request\\) plugin and is provided within the `sn_uni_req` namespace.\n\nFor information, refer to [Universal Request](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/employee-service-management/ur-landing-limitedaccess.md).\n\n**Parent Topic:**[Server API reference](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/api-reference/server-api-reference/api-server.md)\n\n## UniversalRequestUtilsSNC - createUniversalRequest\\(Object copyFields\\)\n\nCreates a universal request and returns the sys\\_id of the newly created universal request record.\n\nThis method is called using the UniversalRequestUtils prototype in the `sn_uni_req` namespace. For example, `sn_uni_req.UniversalRequestUtils().createUniversalRequest(<copyFields>)`.\n\n<table id=\"table_agv_xrd_gnb\" class=\"parameters\"><thead><tr><th>\n\nName\n\n</th><th>\n\nType\n\n</th><th>\n\nDescription\n\n</th></tr></thead><tbody><tr><td>\n\ncopyFields\n\n</td><td>\n\nObject\n\n</td><td>\n\nJSON object containing field names and values to set on a new record in the Universal Requests \\[universal\\_request\\] table.Provide details by field name and field value in the format `{ '<field_name>': '<field_value>' }`. The following fields are considered the most useful details to assign to a primary ticket.\n\n```\n\n{\n  'assignment_group': 'String',\n  'assigned_to': 'String',\n  'contact_type': 'String',\n  'description': 'String',\n  'opened_by': 'String',\n  'opened_for': 'String',\n  'priority': 'String',\n  'restricted': Boolean,\n  'short_description': 'String'\n};\n```\n\nOther fields not listed might be eligible for your use case. For a list of table fields and related fields in the system, view the [Data dictionary tables](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/platform-administration/c_DataDictionaryTables.md).\n\n**Note:** Do not include the primary\\_ticket or sys\\_id fields in the copyFields JSON object.\n\n</td></tr><tr><td>\n\ncopyFields.assignment\\_group\n\n</td><td>\n\nString\n\n</td><td>\n\nOptional. Sys\\_id of the group assigned to the resource.Default: Default assignment group is set per assignment rules.\n\nTable: Group \\[sys\\_user\\_group\\] table.\n\n</td></tr><tr><td>\n\ncopyFields.contact\\_type\n\n</td><td>\n\nString\n\n</td><td>\n\nOptional. Method by which the resource was initially reported.Possible values:\n\n-   chat\n-   email\n-   phone\n-   social\n-   web\n\nMaximum length: 40\n\n</td></tr><tr><td>\n\ncopyFields.description\n\n</td><td>\n\nString\n\n</td><td>\n\nOptional. Detailed description of the problem associated with the resource.Maximum length: 4,000\n\n</td></tr><tr><td>\n\ncopyFields.opened\\_by\n\n</td><td>\n\nString\n\n</td><td>\n\nOptional. Sys\\_id of the person that initially opened the resource. Located in the User \\[sys\\_user\\] table.\n\n</td></tr><tr><td>\n\ncopyFields.opened\\_for\n\n</td><td>\n\nString\n\n</td><td>\n\nOptional. Required for HR Service Delivery cases. The sys\\_id of the user for whom the resource was opened.\n\n</td></tr><tr><td>\n\ncopyFields.priority\n\n</td><td>\n\nString\n\n</td><td>\n\nOptional. Priority of the resource. Specified as a number.Possible values:\n\n-   1: Critical\n-   2: High\n-   3: Moderate\n-   4: Low\n\nDefault: 3\n\n</td></tr><tr><td>\n\ncopyFields.restricted\n\n</td><td>\n\nBoolean\n\n</td><td>\n\nOptional. Flag that indicates if the universal request has restricted access. Refer to [Universal Request roles and groups](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/employee-service-management/ur-roles.md).\n\n Valid values:\n\n-   true: Universal request is only accessible to users with the `sn_uni_req.sensitiveinfo_agent` role. Users with this role have permissions to view sensitive information, such as payroll details.\n-   false: Universal request access is unrestricted.\n\n Default: false\n\n</td></tr><tr><td>\n\ncopyFields.short\\_description\n\n</td><td>\n\nString\n\n</td><td>\n\nConcise description of the resource.Maximum length: 160\n\n</td></tr></tbody>\n</table>|Type|Description|\n|----|-----------|\n|String|Sys\\_id of the newly created universal request record.|\n\nThe 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.\n\n```\nvar copiedFields = {\n  'opened_for': \"<user_sys_id>\",    \n  'short_description': email.subject,\n  'restricted': false,\n  'priority': '1'\n};\n\n// createUniversalRequest() must be called to create the universal request prior to creating the child case\n\nvar ur = new sn_uni_req.UniversalRequestUtils().createUniversalRequest(copiedFields);\ncurrent.universal_request = ur;\n\n```\n\n"}}