Last call to make your voice heard! Our 2022 Developer Survey closes in less than a week. Take survey.

Hot answers tagged

26 votes
Accepted

How to Disable ui.button in Lightning Component

The right syntax to do this is below var btn = event.getSource(); btn.set("v.disabled",true);//Disable the button
user avatar
24 votes

How to check if a record is locked or not in Apex during an approval process

This came out in Winter16. It's part of the approval class Approval.isLocked(recordId) This method can also accept List<Id>, SObject, or List<SObject>. You can also now lock and unlock ...
user avatar
10 votes

Dynamically changing lightning button icon name with setAttribute not working

setAttribute is for setting HTML attributes. For component attributes, use direct assignment: event.target.iconName='utility:check" If you use query selectors, just remember that if it's not an HTML ...
user avatar
  • 430k
10 votes

Get button name or Id in LWC?

id shouldn't be used, because it is used by the framework for rendering purposes. Instead, just use a data attribute to specify the name: <button data-name="myButtonName" ... /> ... ...
user avatar
  • 430k
8 votes

Making trigger into a custom button

First, make your trigger into a static webservice function: global class OpportunityWS { webservice static void createAsset(Id opportunityId) { // Do logic here } } Then, create a custom ...
user avatar
  • 430k
8 votes
Accepted

LWC: Only enable button if options are available

You need to use the property with the get method. JS get disableButton(){ return !(this.options && this.options.data && this.options.data.length); } HTML <lightning-button ...
user avatar
  • 10.5k
7 votes
Accepted

When is the Sharing Button visible for a Record?

There is a small article on Salesforce help You have access to the Sharing button when your sharing model is either Private or Public Read Only for a type of record or related record. For example, ...
user avatar
  • 2,111
7 votes
Accepted

Custom Button on Lightning Experience

Please refer to this: https://help.salesforce.com/articleView?id=actions_in_lex.htm&type=0 In Lightning Experience, actions display in the Global Actions menu in the header, on related lists, on ...
user avatar
  • 10.6k
6 votes
Accepted

Unable to disable a button in lightning

The v. prefix is used to access aura:attribute values. To invoke a controller method you need to use the c. prefix i.e.: onclick="{!c.clickHandle}" See e.g. Trailhead's Handle Actions with ...
user avatar
  • 129k
6 votes
Accepted

ShowToastEvent notification is not displayed in LWC

As you can see here platformShoToastEvent can only be used in Lightning Experience explicitly. Since standard toasts are based on Appliacation Events there is nothing to handle your event in Lightning ...
user avatar
5 votes

Is it possible to remove/hide the "New" button?

Try this app - just came up on a call today! I believe this would allow what you are asking to do. https://appexchange.salesforce.com/listingDetail?listingId=a0N3000000B4AJKEA3
user avatar
5 votes

Javascript Button Error: Missing )

If the Account name includes a single quote the JavaScript would then be invalid because that single quote would be interpreted as a string delimiter. Using {!JSENCODE(Account.Name)} would protect ...
user avatar
  • 129k
5 votes
Accepted

Clone record issue

You can query for created date for both records and whichever has later date that is cloned.
user avatar
  • 5,714
5 votes

Visualforce page with custom conroller not available for button

Recommended reading: Difference between controller and extensions Here you are working on writing a Controller Extension. You add this Apex Class to your page via the extensions attribute on the <...
user avatar
  • 142k
5 votes

Read value attribute in lightning button in the client js controller

Now you can use event.getSource().get("v.value") function to get lightning button value when clicked. From the Salesforce documentation: In the client-side controller, you can use one of the ...
user avatar
5 votes

Align SLDS buttons to right

You should be able to use the SLDS Float classes: <div id="hidden"> <div class="slds-float--right"> <!--Add Folder Button--> <button class="slds-button slds-...
user avatar
  • 430k
5 votes
Accepted

Can anyone suggest how to do an animation effect like Standard Refresh button do in Lightning Component?

It is created via following css class: .forceListViewManagerHeader .rotate svg { animation: rotate .4s; } Check the screenshot also
user avatar
  • 523
4 votes
Accepted

How to call a managed-package page controller's method from your apex?

It very much depends on whether the author of the managed package intended the method to be called in this manner. If the page controller exposes the action behind the button globally, there may be a ...
user avatar
4 votes
Accepted

Show Warning Popup on standard Save Button Click

The only supported way to achieve this is through Visualforce, by overriding the entire page. You can't customise the flow of the standard pages, outside of hacking some JavaScript in the sidebar, but ...
user avatar
  • 19.7k
4 votes
Accepted

Remove or Hide New task/New Event button from Activity List View

You would need to go and edit the page layout for the object you want to do this for. Find the Open Activities and Activity History related lists. Click on the Wrench Icon, and go to the Buttons ...
user avatar
4 votes

Custom button on account list view to assign child records to parent

Click on the tab where you have or will create the list view. In this example, it's Contact Click Create New View Give the view a List View Name and Unique Name For the filter criteria, select what ...
user avatar
  • 13.3k
4 votes

<button type="submit"> apex equivalent

To further illustrate Eric's comment, You would implement his suggestion like so: Define your button (the button calls the javascript function doSomething) that is defined by the actionFunction: <...
user avatar
4 votes
Accepted

New button in Lightning

Create a new record in Lightning You may want to opens the page to create a new record for the specified entityApiName, for example, “Account” or “myNamespace__MyObject__c”. To display ...
user avatar
4 votes
Accepted

Press button from apex trigger

Put a soft alert on the page using a conditional image formula IF (NOT(IsApproved__c) && HasDiscountExceedingGuidelines__c , IMAGE("/img/samples/flag_red.gif" , 'Red' ,12,12) & ...
user avatar
  • 61.5k
4 votes
Accepted

Javascript Button User Permissions

You can use sforce.connection.describeSObject, which gives you an DescribeSObjectResult, which includes the fields, and if they're createable and/or updateable. This describe result respects profile ...
user avatar
  • 430k
4 votes
Accepted

APEX Code with Pardot and Salesforce

Don't use new lines randomly. In this case, you broke up {!$Api and .Session_ID}, so the system didn't recognize the merge field correctly. The formula should look exactly as shown in the doc, one ...
user avatar
  • 430k
4 votes
Accepted

How to get all buttons in my page from a controller javascript function(component, event, helper)?

Add an aura:id to the <ui:button /> component, then find the button by it. component: <ui:button aura:id="btn" label="A" press="{!c.disableMe}"/> <ui:button aura:id="btn" ...
user avatar
  • 10.1k
4 votes
Accepted

AfterRender on button in Lightning Component (DOM update)

I would not use afterRender to attach events, as you'll end up possibly adding duplicate events. Here's a simplified version that does not rely on a renderer: <aura:application > <div id=...
user avatar
  • 430k
4 votes
Accepted

"Log in to Community as User" Button Missing

With Winter '18, Users can manage Community Users in Lightning Experience. Snippet from the release notes: No more switching between Lightning Experience and Salesforce Classic to manage external ...
user avatar
  • 28.9k
4 votes

Why are Lightning Actions for Case Object showing in Feed?

This is a expected behaviour from salesforce when feed tracking is enabled for cases or work orders, the page-level action menu on those records contains only custom buttons and supported standard ...
user avatar
  • 12.6k

Only top scored, non community-wiki answers of a minimum length are eligible