0

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:

{!REQUIRESCRIPT("/soap/ajax/25.0/connection.js")} 
if('{! Order.Product_Count__c}' < 1){ 
alert('You need a Product Line Item before sending the RMA to the customer'); 
} 
else 
if('{!Order.BillingStreet}' == ""){ 
alert('There is no pickup address - please enter/select one first'); 
} 
else 
if('{!Order.Freight_Choice__c}' == ""){ 
alert('Please select a Freight Choice (in "Courier Information" section) before generating the email'); 
} 
else{ 
window.location='/apex/CreateRMAEmail?id={!Order.Id}'; 
}

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?

3

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.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.