Update Caller Record in SOW

KeithM1
Tera Expert

Hello All - I'm trying to update the Caller Record in SOW to show Recent Requests the same as the Recent Incidents

KeithM1_0-1776370685955.png

 

In UI builder, I went to SOW - Sidebar tabs top 

KeithM1_1-1776370973772.png

and found the Caller Record.  I duplicated the Recent Incidents_tier 1 and called it Recent Requests.  From there on the right-hand side of the screen, on the Configure tab, there is Component Visibility, which is this:  

KeithM1_2-1776371097249.png

I need to change it so that instead of the incident table it is the RITM table (sc_req_item).

 

I guess my question is two-fold:  1) am I on the right track and 2) if I am, how do I change the name of the table from incident to sc_req_item?  It's not as simple as highlight and just type it in unfortunately.

 

I appreciate any and all help with this!

5 REPLIES 5

Shruti
Giga Sage

Hi 

1. Duplicate recent incident component and update the label of new component to recent requests

Shruti_0-1776411935866.png

 

2. Update the highlighted values in event mapping panel

Shruti_1-1776411979759.png

 

Shruti_2-1776412003263.png

 

3. Navigate to sys_ux_data_broker_transform.LIST

Shruti_3-1776412095730.png

Update the highlighted lines to the script 

function transform(input) {
    if (!input || !input.callerId || !input.table || !gs.tableExists(input.table)) return [];
    var table = input.table;
    const HARDWARE = "alm_hardware";
    const COMPUTER_CLASS = "cmdb_ci_computer";
    const INCIDENT = "incident";
    const INTERACTION = "interaction";
    const ALM_ASSET = "alm_asset";
    const REQUEST = "sc_req_item";
    var callerRecords = [];
    var callerField = (table == INCIDENT) ? "caller_id" : (table == INTERACTION) ? "opened_for" : (table == REQUEST) ? "opened_by":"assigned_to";
    var sysId = input.sysId;
    var gr = new GlideRecord(table);
    if (table != ALM_ASSET) {
        gr.addEncodedQuery(input.recentQuery,true);
        gr.orderByDesc('sys_created_on');
    }
    gr.query(callerField, input.callerId);
    gr.setLimit(10);
    gr.query();
    while (gr.next()) {
        if (sysId && sysId == gr.getValue('sys_id')) continue;
        var record = {
            'table': table,
            'sys_id': gr.getValue('sys_id')
        };
        if (table == ALM_ASSET) {
            record["display_name"] = gr.display_name.getDisplayValue();
            record["class"] = gr.getValue('sys_class_name');
            record["labelled"] = [];
            record["computer_sysid"] = gr.ci.sys_id.toString();
            if (record["class"] === HARDWARE) {
                record["hardware_class"] = gr.ci.sys_class_name.toString();
                if (gr.getValue('asset_tag')) record["labelled"].push({
                    "label": gr.asset_tag.getLabel(),
                    "value": gr.getValue('asset_tag')
                });
                if (gr.getValue('serial_number')) record["labelled"].push({
                    "label": gr.serial_number.getLabel(),
                    "value": gr.getValue('serial_number')
                });
                if (record["hardware_class"] === COMPUTER_CLASS) {
                    if (gr.ci.name.toString()) record["labelled"].push({
                        "label": gr.ci.name.getLabel(),
                        "value": gr.ci.name.toString()
                    });
                    if (gr.ci.os.toString()) record["labelled"].push({
                        "label": gr.ci.os.getLabel(),
                        "value": gr.ci.os.toString()
                    });
                    if (gr.ci.os_version.toString()) record["labelled"].push({
                        "label": gr.ci.os_version.getLabel(),
                        "value": gr.ci.os_version.toString()
                    });
                }
            } else continue;
        } else {
            record["number"] = gr.getValue('number');
            record["sys_created_on"] = gr.getValue('sys_created_on');
            record["short_description"] = gr.getValue('short_description');
            if (table == INCIDENT) {
                record["priority"] = gr.getValue("priority");
                record["priority_label"] = gr.getDisplayValue("priority");
                record["labelled_row_one"] = [];
                record["labelled_row_two"] = [];
                if (gr.getValue('priority')) record["labelled_row_one"].push({
                    "label": gr.priority.getLabel(),
                    "value": gr.getDisplayValue('priority')
                });
                if (gr.getValue('sys_created_on')) {
                    var gdt = new GlideDateTime(gr.getValue('sys_created_on'));
                    var dateOnly = gdt.getDate().getDisplayValue();
                    record["labelled_row_one"].push({
                        "label": gs.getMessage("Opened"),
                        "value": dateOnly
                    });
                }
                if (gr.getValue('state')) record["labelled_row_two"].push({
                    "label": gr.state.getLabel(),
                    "value": gr.getDisplayValue('state')
                });
                if (gr.getValue('assignment_group')) record["labelled_row_two"].push({
                    "label": gr.assignment_group.getLabel(),
                    "value": gr.getDisplayValue('assignment_group')
                });
            }
            if (table == INTERACTION || table == REQUEST) {
                record["labelled"] = [];
                record["type"] = gr.getValue("type");
                record["interaction_type_label"] = gr.getDisplayValue("type") + " - ";
                if (gr.getValue('sys_created_on')) {
                    var gdt = new GlideDateTime(gr.getValue('sys_created_on'));
                    var dateOnly = gdt.getDate().getDisplayValue();
                    record["labelled"].push({
                        "label": gs.getMessage("Opened"),
                        "value": dateOnly
                    });
                }
                if (gr.getValue('state')) record["labelled"].push({
                    "label": gr.state.getLabel(),
                    "value": gr.getDisplayValue('state')
                });
            }
        }
        callerRecords.push(record);
    }
    
    return callerRecords;
}

 

 

4. Go to Caller records view port -> Caller records default

Shruti_4-1776412241381.png

5. Create the duplicate of interaction values under card body and rename it to Request values and update the table name in hide component condition

Shruti_5-1776412386703.png

 

 

Shruti,

This has been SUPER helpful.  It got me a lot further than I was.  I have run into an issue though.  After going through all these steps, it shows up as expected:  

KeithM1_0-1777408010334.png

However, when I click on it, nothing comes up  

KeithM1_1-1777408048920.png

I go back to the UI builder, and change the Hide component from incident to sc_req_item  

KeithM1_2-1777408104907.png

KeithM1_3-1777409195349.png

When I refresh, the link to Recent Requests disappears  

KeithM1_4-1777409244524.png

Thoughts and ideas on what could be the cause and what I can do to fix it?

Hi

Make there are request items opened by the logged in user to see the recent request list

 

The one user I'm testing with has at least 2 RITMs where she is the Requested For that are Open and active