Hide UI Action based on the related list record

Saranya K
Tera Contributor

Hi all,

How to hide the related link based on the condition like if no record present in the related list tab and column in related list records.

we need to check two conditions. 

For example,

1.in the above screenshot the outage tab is there in the related list currently there is no record   we need to hide the related link PO Question in incident form.

2.If the record is there in the Outage tab we need to check the begin and end column is empty if that is empty, then also we need to hide the related link PO Question in incident form.

 

can anyone help me on this how we can give these 2 conditions in UI action.

 

SaranyaK_0-1669727577082.png

 

SaranyaK_1-1669727681654.png

 

 

Thanks,

Saranya K

 

1 ACCEPTED SOLUTION

Kalyani Jangam1
Mega Sage
Mega Sage

Hi @Saranya K 

call SI in UI action condition using below code

UI action condition=>var Validation().CheckIncident(current.sys_id);

 

CheckIncident: function(num) {
gs.addInfoMessage("SI calsss");
var answer;
var gr = new GlideRecord('incident');// please glide outage table
gr.addQuery('parent_incident', num);// as per your parent related list field
gr.query();
if (gr.getRowCount == 0) {
gs.addInfoMessage("In iff loop");
answer = true;
}
else if(gr.next()){
var test=gr.description;// your start date field name
var test1=gr.short_description;// your end date field name
if(test == '' && test1==''){
gs.addInfoMessage("In start and end date");
answer=true;
}

}
return answer;

 

Please try and it will help you. Please mark correct answer if it will help you.

View solution in original post

1 REPLY 1

Kalyani Jangam1
Mega Sage
Mega Sage

Hi @Saranya K 

call SI in UI action condition using below code

UI action condition=>var Validation().CheckIncident(current.sys_id);

 

CheckIncident: function(num) {
gs.addInfoMessage("SI calsss");
var answer;
var gr = new GlideRecord('incident');// please glide outage table
gr.addQuery('parent_incident', num);// as per your parent related list field
gr.query();
if (gr.getRowCount == 0) {
gs.addInfoMessage("In iff loop");
answer = true;
}
else if(gr.next()){
var test=gr.description;// your start date field name
var test1=gr.short_description;// your end date field name
if(test == '' && test1==''){
gs.addInfoMessage("In start and end date");
answer=true;
}

}
return answer;

 

Please try and it will help you. Please mark correct answer if it will help you.