Quantcast
Channel: Convert Javascript button to Lightning Action - Salesforce Stack Exchange
Viewing all articles
Browse latest Browse all 2

Convert Javascript button to Lightning Action

$
0
0

I have to convert many javascript buttons into Lightning Action to open VF Page. Below is an example of a button on the Account record page.

if( (accStatus != "Active" && accStatus != "Suspended") || openOpps > 0) {
var reasonWhy = '';    
if (accStatus != "Active" && accStatus != "Suspended") {
reasonWhy = 'Account Status is not Active or Suspended. ';
} else if (openOpps > 0) {
reasonWhy = 'There are open Opportunities associated to this Account.';
}    
alert('This Account cannot be closed: ' + reasonWhy);    
}
else {
var theUrl = '/apex/CloseActiveAccount?id={!Account.Id}';

No luck with Lightning converter that recommends a manual conversion. I have no problem with the redirect to url in the Aura component but do not really know where and how to manage the validations and messages (APEX controller, javascript controller, helper...). Thanks in advance for your help. Sylvie


Viewing all articles
Browse latest Browse all 2

Latest Images

Trending Articles





Latest Images