Fetching Sys IDs of selected records from related list to description

Arpit_S
Tera Contributor

Hi, 

 

I was trying something weird/new.

 

On Incident form, I have a related list. if I select few records and click on UI action 'Custom - Attach KB', then it should update the description with Sys ID of selected record and Incident Sys ID on Short Description.

 

I am getting Sys IDs of selected records, but not getting Incident Sys ID.

 

I am trying cutting URL and fetching Sys ID method. 

 

I want to know, is it wrong here to get URL after clicking UI Action? if Yes, then what should be the approach?

 

Note:

1. Cant use current as related list is on  'kb_knowledge' table.

2. same goes for g_form.getUniqueValue().

 

UI Action:

Arpit_S_0-1702314896017.png

 

UI Action Script:

function FetchFromList() {
    var url_string = gs.getProperty("glide.servlet.uri") + gs.action.getGlideURI();
    var start = url_string.indexOf("sys_id=") + 7;
    var end = url_string.indexOf("sys_id=") + 39;
    var sub_string_sys_id = url_string.substring(start, end);
 
    var abc = new GlideRecord("incident");
    abc.addQuery('number', 'INC0010329');
    abc.query();
    abc.next();
    abc.description = "sys_idIN: " + g_list.getChecked();
    abc.short_description = sub_string_sys_id;
    abc.update();
}

 

OUTPUT - Incident Short Description and Description:

Arpit_S_2-1702315137141.png

 

5 REPLIES 5

Hi Brad,

 

my apologies for delay in my response. It is not working. the requirement was dropped, not needed anymore. Thanks for the response.

 

End goal: In related list, we would have all knowledge articles, in that, Analyst will select few KB Articles, and these Articles needed to be attached to 'KB Attached' related list of particular Incident.