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

Danish Bhairag2
Tera Sage

Hi @suuriya ,

 

U need to add some code in the existing UI action Edit Relationships,

 

Please follow below steps:

  • Navigate to System UI -->UI Action
  • Search Name is Edit Relationships
  • If there is only one record found open that record.
  • If the UI action is created on business app table then u can write the below code

if(current.status == "retired" || current.status == "transferred"){

g_addInfoMessage('you can't edit it');

}

 

If the UI action is client checked then replace the if condition with

 

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

alert(' you can not edit this');

}

 

Thanks,

Danish

 

HI @Danish Bhairag2 ,

 

Thanks for your reply...I checked it(edit relationship) is not ui action it is UI Page.....For Ui Page how we can write the script....how we can achieve this

Hi @suuriya ,

 

Possible to share a snip of the UI page please.

 

Thanks,

Danish