How to update a related list, list control record with background script to remove "Edit" button based on some condition.

Pravallika14
Tera Contributor

Hello Team,

I have few related lists on few Ticketing Modules. .and I want to remove "Edit" button on one of the related list on HR Form, based on some condition. For EX: if the ticket state is transferred, The below related list should not have "Edit" button available.

find_real_file.png

I tried to update the List control record directly by giving the "omit Edit condition" .however due to Application scopes vs Record scope mismatches , I could not save the record with my changes.

find_real_file.png

find_real_file.png

Hence , I wanted to remove the "Edit" button using a background script. Can someone please help me how can I write a background script to remove "Edit" button based on the below condition.

var answer;

if(parent.state == 9)
{
answer =true;
}
else{
answer = false;
}

 

Hi @Ankur Bawiskar ,

Could you please check and assist on this.

1 ACCEPTED SOLUTION

Hi,

you can try to check that as well in condition by getting the parent class name

Regards
Ankur

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

View solution in original post

6 REPLIES 6

Hi @Ankur Bawiskar ,

 

This should be applied to only HR Ticketing forms/table .What will happen if we change the table name to "m2m_kb_task".I am just thinking if this applies to all other modules 

Hi,

you can try to check that as well in condition by getting the parent class name

Regards
Ankur

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader