Get Sys_id of current incident record in list banner button in Related list

harishdasari
Tera Guru

Hi,

we are creating a List Banner Button under the Related Link Affected CI's as shown in screenshot.

Here it is referring to a custom table called "u_ci_m2m_server", in this table there are 2 fields one is Task(Reference field) and other field is CI(reference field pointing to cmdb_ci_server)

Now when user click on this button, it should get the current incident to be mapped with field TASK and current configuration item selected on the incident.

since I am creating the UI action on task_ci table, I cannot directly use the current.sysid to get the sys_id of the incident. How can I relate and make the incident to map with Task field in custom table.

find_real_file.png

1 ACCEPTED SOLUTION

harishdasari
Tera Guru

Thanks Prasad,

What actually I was searching is this below code and it is very useful for us to find the parent record sys_id in List banner UI actions under related list.

Actually when there are M2M tables who need the parent sys_id then the below code will help them to get the parent sys_id on server side UI action.

This is Undocumented.

var uri = action.getGlideURI();
var path = uri.getFileFromPath();
var collectionId = uri.get('sysparm_collectionID');
gs.addInfoMessage(collectionId);

 

Thank you.

View solution in original post

2 REPLIES 2

Prasad Pagar
Mega Sage

Hi,

You are merging two things

List Banner Button and Related Links.

I will suggest to create it as Form link on Incident form where you can take current ci and task and add in your custom table.

find_real_file.png

It will look like below

find_real_file.png

Hope this helps 🙂

Please mark my answer correct and helpful if applicable.

Thank you
Prasad

harishdasari
Tera Guru

Thanks Prasad,

What actually I was searching is this below code and it is very useful for us to find the parent record sys_id in List banner UI actions under related list.

Actually when there are M2M tables who need the parent sys_id then the below code will help them to get the parent sys_id on server side UI action.

This is Undocumented.

var uri = action.getGlideURI();
var path = uri.getFileFromPath();
var collectionId = uri.get('sysparm_collectionID');
gs.addInfoMessage(collectionId);

 

Thank you.