Display an Error message on clicking the button.

suuriya
Tera Contributor

Hi,

 

I have a requirement, in APM record there is section called relations and there is button named edit relationships...if I click the button it redirects to different page to edit relations...now for records which are in retired or transferred status then on clicking the button it should not redirect to next page instead it should throw an error like "you can't edit it".

 

The idea here is if the records are in transferred or retired status then the button should not perform instead throw an error.

suuriya_0-1698690991309.png

 

How to achieve this please explain in detail.

Thanks in advance

5 REPLIES 5

Hi @suuriya ,

 

In UI Page generally we have diff section of HTML, Client Script & other fields. In your screenshot its not available assuming as the protection policy is protected. So generally the logic which you need to write would be under the function which gets executed whenever the edit relation ship button is pressed.

 

U should be able to find the function in your html section of the code , code within the function will be present in client script where u can try to add this line

 

if(g_form.getValue('status') == 'retired' || g_for.getValue('status') == 'transferred'){

alert(' you can not edit this');
return;

}

 

Attaching sample UI page for your reference

DanishBhairag2_0-1698753628205.png

 

Thanks,

Danish