Hot answers tagged

26

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


23

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 them from Apex. See the documentation on the Approval class.


10

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 component, use the direct assignment method.


8

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 JS button or link on the opportunity: {!RequireScript("/soap/ajax/34.0/connection.js")} {!RequireScript("/soap/ajax/34.0/apex.js")} function success() { //...


8

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" ... /> ... onClickHandler(event) { var buttonName = event.target.dataset.name; ... ... Edit: I also created a quick playground that demonstrates this.


7

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, the Sharing button may appear on an account even though your organization-wide default for accounts is Public Read/Write, if your organization-wide default for ...


7

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 list view items, and in several places on a record page. Where they appear on a record page depends on the action’s type. [...] The page-level action menu in ...


6

You said you want to send it to "fixed email address" You don't need "To" field. "To" will correspond to "recipient" record (Contact/Lead/User) which can be referred to in the email template. For just a hardcoded mailbox use "Additional To" instead: &p24=example@example.com If you want to populate the "To" after all p2 is the visible name field, "John ...


6

This is how I solved this issue: public Boolean doesOpportunityHavePendingApproval() { return ![ Select Id From ProcessInstance WHERE TargetObjectId =: theOpportunity.Id AND Status = 'Pending' ].isEmpty(); }


6

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 Controllers. I don't know why the button is silently failing for you. For me I got an error dialog that hinted at the problem: Access Check Failed! AttributeSet.get()...


5

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


5

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 against that as described in the JSENCODE documentation: Encodes text and merge field values for use in JavaScript by inserting escape characters, such as a ...


5

You can query for created date for both records and whichever has later date that is cloned.


5

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 <apex:page> tag. If you want to enable a Detail Button on Account, your Visualforce Page must use the standardController attribute. <apex:page ...


5

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 following methods to find out which button was clicked: event.getSource().getLocalId() returns the aura:id of the clicked button. event.getSource().get("v....


5

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-button--icon folder" onclick="{!c.modalFolOpen}" aria-live="assertive"> <c:svg ariaHidden="true" class="slds-icon--small slds-button__icon" ...


5

It is created via following css class: .forceListViewManagerHeader .rotate svg { animation: rotate .4s; } Check the screenshot also


5

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 OutApp. So what usually happens with toast events? You dispatch an event which is most probably set to propagate outside shadow DOM boundary (see ...


5

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 variant="brand" label="Add" title="Add object" onclick={handleAdd} class="slds-m-left_small" ...


4

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 good chance that you can. Of course, there maybe other variables on the page and/or controller itself that might be required to make that method call successful....


4

You are mixing your drinks! Looks like you want client-evaluated code in server-evaluated functions ;-) Try this: window.parent.location.href="{!URLFOR($Action.Event.NewEvent, null, [ who_id=pba__Request__c.Id, what_id=pba__Request__c.Id, retURL=URLFOR($Action.pba__Request__c.View, pba__Request__c.Id), evt3=pba__Request__c.Name, evt5="...


4

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 even if you go that route it is highly likely to stop working in Summer 15. One way I've used to achieve similar functionality to that you require is to add a ...


4

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 section. There are checkboxes for all the buttons. Just uncheck the buttons you do not want to show. EDIT Thanks to @BarCotter, you also need to update the ...


4

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 would comprise the view and this is the most important part: YOU MUST ADD A FILTER FOR THE RECORD TYPE IF THE OBJECT INCLUDES RECORD TYPES. You can only bulk ...


4

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: <button type="submit" onclick="doSomething()"> <span></span> </button> Define your controller action: public PageReference ...


4

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 the record create page for an object, set the object name on the entityApiName parameter and fire the event. recordTypeId is optional and, if provided, ...


4

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) & ' Discount exceeds guidelines. Override using checkbox' & BR(), NULL) Add a checkbox OverrideDiscountWarning__c Alter the trigger to ...


4

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 permissions. Unfortunately, it's quite a bit of work, as you basically have to do this: var result = sforce.connection.describeSObject('Dog__c'); var allowed = ...


4

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 long continuous text.


4

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" label="B" press="{!c.disableMe}"/> <ui:button aura:id="btn" label="Enable them all!!!" press="{!c.myClearButtonClicked}"/> ...


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