I have the following custom button on my Classic Order object page layout, which is an 'Execute Javascript' one and the OnClick Javascript is as follows:

if('{! Order.Product_Count__c}' < 1){ 
alert('You need a Product Line Item before sending the RMA to the customer'); 
if('{!Order.BillingStreet}' == ""){ 
alert('There is no pickup address - please enter/select one first'); 
if('{!Order.Freight_Choice__c}' == ""){ 
alert('Please select a Freight Choice (in "Courier Information" section) before generating the email'); 

I would like to be able to convert this to something that works in Lightning AND Classic (without having to use the button), but am struggling to find ways to do this. I do not want to leave the Order page if the 3 conditions fail - if they pass it goes to a VF page. I have looked at Quick Actions but it needs to sit on the page like the button does, not in the Feed (it's not used on Orders, only Cases).

Could someone please help me do this right?

1 Answer 1


Leave the JS button as is, and it'll only show on the Classic layout. Create a Lightning Component Quick Action which will read the value from the record and either display the appropriate message or redirect.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .