0

I have a custom button that's supposed to update a field on the Account Object. I made this work via Javascript process, but the problem is this Custom button won't show up under custom links in Account object when in Lighting, it only shows up if I am using Classic.

On the warning it says Java script behavior isn't supported in lighting, what else can I do to update a field on the Account object?

Here is the code I have thas currently working but it's Javascript.

{!REQUIRESCRIPT("/soap/ajax/19.0/connection.js")}
var accnt = new sforce.SObject("Account");
accnt.Id = '{!Account.Id}';
accnt.wow= 'True';

var result = sforce.connection.update([accnt]);
if(result[0].getBoolean("success"))
{
alert('Running process...');
window.location.reaload();
}
else 
{
alert('Error : '+result);

}

How can I archive this without using the Java Script

2 Answers 2

1

So Javascript buttons don't work in Lightning experience. So for your usecase, first you need to create an object action (aka quick action) by creating a button in Account object where you need to select "Action Type" as "Update a Record". After that, modify the Publisher Actions Layout by dragging the newly created action to the Publisher Actions section.

You can check the link below for more information and perform the 1st and 3rd steps to replicate the scenario with your needs:

https://ccoenraets.github.io/salesforce1-app-tutorial/object-action-update-record.html
1
  • For some reason when I create an Action and add it to the page layout it won't show, also how do I tell the action to update " A " field? Apr 12, 2021 at 21:15
0

Setting>object manager>your object>Lightning record pages. Click on the top object where your buttons are and add an action on the right side. Find your newly created button and add it here.

You must log in to answer this question.

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