<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>question Re: Trying to setting category from a record producer in Incident Management forum</title>
    <link>https://www.servicenow.com/community/incident-management-forum/trying-to-setting-category-from-a-record-producer/m-p/3075895#M9794</link>
    <description>&lt;P&gt;Can you add toString() and see if it works?&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;var selectedIssue = producer.issue_descriptions.toString();&lt;/LI-CODE&gt;</description>
    <pubDate>Wed, 16 Oct 2024 21:25:15 GMT</pubDate>
    <dc:creator>Anish Singh</dc:creator>
    <dc:date>2024-10-16T21:25:15Z</dc:date>
    <item>
      <title>Trying to setting category from a record producer</title>
      <link>https://www.servicenow.com/community/incident-management-forum/trying-to-setting-category-from-a-record-producer/m-p/3075881#M9792</link>
      <description>&lt;P&gt;Im trying to set my category field on the incident form based on a variable collected from the record producer. the following is what i currently have, but it is only setting to the default.&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;var isMobile = GlideMobileExtensions.getDeviceType() == 'm';
var link = isMobile ? '#/!list/incident/q:active=true%5Ecaller_id=javascript&amp;amp;colon;gs.user_id()%5EEQ' : 'home.do';

var linkLbl = isMobile ? "List" : "Homepage";
var br = '&amp;lt;br/&amp;gt;';
var linkURL = '&amp;lt;a href="' + link + '"&amp;gt;' + gs.getMessage(linkLbl) + '&amp;lt;/a&amp;gt;';
var msgArgs = [br, linkURL];

var callerSysID = gs.getUserID();
var parent_table = RP.getParameterValue('sysparm_parent_table');
if (JSUtil.notNil(parent_table)) {
    var parent_map = new GlideRecord('request_parent_mapping');
    parent_map.addQuery('parent_table', parent_table);
    parent_map.query();
    if (parent_map.next())
        var requested_for_field = parent_map.getValue('requested_for_field');
    var parentGR = new GlideRecord(parent_table);
    parentGR.addQuery('sys_id', RP.getParameterValue('sysparm_parent_sys_id'));
    parentGR.query();
    if (parentGR.next())
        callerSysID = parentGR.getValue(requested_for_field);
}

var callerGR = new GlideRecord('sys_user');
callerGR.get(callerSysID);
var callerDV = callerGR.getDisplayValue();

//set service and service offering
current.contact_type = 'self-service';
current.caller_id = callerSysID;
current.business_service='377d075ec3c40610618d1fb4e4013126'; //377d075ec3c40610618d1fb4e4013126 = 'ATM/ITM' service
current.service_offering = '445ecb5ec3c40610618d1fb4e40131eb'; // 445ecb5ec3c40610618d1fb4e40131eb = 'ATM/ITM' offering

//Set Description
var descriptionStr = producer.cmdb_ci.name;
descriptionStr += " at location " + producer.cmdb_ci.location.name;
descriptionStr += " has and issue of " + producer.issue_descriptions;
current.short_description = descriptionStr;


//Set Assignment Group
current.assignment_group = "9ac98878c326b150618d1fb4e4013134"; //9ac98878c326b150618d1fb4e4013134 = Cash Delivery Systems
// Set Category (server-side)
var selectedIssue = producer.issue_descriptions;
switch (selectedIssue) {
    case 'ATM Side':
    case 'Audio':
    case 'Audio/Video':
    case 'Black Screen':
    case 'Frozen Session':
    case 'Lost Comms':
    case 'Offline':
    case 'Session Closed Unexpectedly':
    case 'Session Froze':
        // Set the Category field value to 'connectivity'
        current.category = 'connectivity';
        break;

    case 'Project - Professional Services':
        // Set the Category field value to 'database'
        current.category = 'database';
        break;

    default:
        // Optionally, set a default category or handle other cases
        current.category = 'Communication'; // or any default value
        break;
}
var incRPUtil = new LinkRecordProducerToIncident();
incRPUtil.linkRecordProducerToParentIncident(RP.getParameterValue('sysparm_parent_sys_id'), current);&lt;/LI-CODE&gt;&lt;P&gt;also her is a screen shot of the choices for the issue_descriptions variable&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="RyanBader_0-1729112349862.png" style="width: 400px;"&gt;&lt;img src="https://www.servicenow.com/community/image/serverpage/image-id/395463i88409DE6ABAC062E/image-size/medium?v=v2&amp;amp;px=400" role="button" title="RyanBader_0-1729112349862.png" alt="RyanBader_0-1729112349862.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 16 Oct 2024 20:59:29 GMT</pubDate>
      <guid>https://www.servicenow.com/community/incident-management-forum/trying-to-setting-category-from-a-record-producer/m-p/3075881#M9792</guid>
      <dc:creator>Ryan Bader</dc:creator>
      <dc:date>2024-10-16T20:59:29Z</dc:date>
    </item>
    <item>
      <title>Re: Trying to setting category from a record producer</title>
      <link>https://www.servicenow.com/community/incident-management-forum/trying-to-setting-category-from-a-record-producer/m-p/3075892#M9793</link>
      <description>&lt;P&gt;The first thing I would do is log selectedIssue before the switch to confirm its value.&lt;/P&gt;</description>
      <pubDate>Wed, 16 Oct 2024 21:06:38 GMT</pubDate>
      <guid>https://www.servicenow.com/community/incident-management-forum/trying-to-setting-category-from-a-record-producer/m-p/3075892#M9793</guid>
      <dc:creator>Brad Bowman</dc:creator>
      <dc:date>2024-10-16T21:06:38Z</dc:date>
    </item>
    <item>
      <title>Re: Trying to setting category from a record producer</title>
      <link>https://www.servicenow.com/community/incident-management-forum/trying-to-setting-category-from-a-record-producer/m-p/3075895#M9794</link>
      <description>&lt;P&gt;Can you add toString() and see if it works?&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;var selectedIssue = producer.issue_descriptions.toString();&lt;/LI-CODE&gt;</description>
      <pubDate>Wed, 16 Oct 2024 21:25:15 GMT</pubDate>
      <guid>https://www.servicenow.com/community/incident-management-forum/trying-to-setting-category-from-a-record-producer/m-p/3075895#M9794</guid>
      <dc:creator>Anish Singh</dc:creator>
      <dc:date>2024-10-16T21:25:15Z</dc:date>
    </item>
  </channel>
</rss>

