Calling Apex method from a Custom Button and Submit to Approval Process
Get link
Facebook
Twitter
Pinterest
Email
Other Apps
To call Apex method from a Custom Button and Submit to Approval Process : Salesforce
1. Create a custom button
{!REQUIRESCRIPT("/soap/ajax/15.0/connection.js")}
{!REQUIRESCRIPT("/soap/ajax/15.0/apex.js")}
var approval = confirm("Are you sure want to send it for approval process?");
if(approval == true)
{
sforce.apex.execute("ApprovalSubmit","sentToApproval",{recordId:"{!Interviewer__c.Id}"});
alert("Set Record for Approval");
}
2. Create a apex class :
global class ApprovalSubmit{
webservice static void sentToApproval(Id recordId) {
Approval.ProcessSubmitRequest req1 = new Approval.ProcessSubmitRequest();
req1.setComments('Submitted for Approval');
req1.setObjectId(recordId);
Approval.ProcessResult res = Approval.Process(req1);
}
}
Happy Sharing...
Everyone has their own favourites, so please feel free to share yours in the comments below!
Salesforce LWC : Compact Layout showing on Hover Sometime we have requirement to show Account name link on standard views, a popup with the Compact Layout shows the details of that record. LWC Parent Component : Template (HTML Code) LWC : JS (Process Code) import { LightningElement,api } from 'lwc'; export default class AccountComponent extends LightningElement { @api recordId; @track objRecordId; handleMouseover(event) { console.log(this.recordId); this.objRecordId = null const toolTipDiv = this.template.querySelector('div.ModelTooltip'); toolTipDiv.style.opacity = 1; toolTipDiv.style.display = "block"; // eslint-disable-next-line window.clearTimeout(this.delayTimeout); // esli
Salesforce Lightning Web Component With Third Party JS : D3 Third-Party JavaScript Libraries Using JavaScript to manipulate the DOM isn’t recommended because the Lightning Web Components engine does it more efficiently. However, there are some third-party JavaScript libraries that take over the DOM. Manipulate the DOM with JavaScript Using JavaScript to manipulate the DOM isn’t recommended because the Lightning Web Components engine does it more efficiently. However, there are some third-party JavaScript libraries that take over the DOM. If a call to appendChild() manipulates the DOM, styling isn’t applied to the appended element. When using these libraries in a Lightning web component, add lwc:dom="manual" to any HTML element that you want to manipulate with JavaScript. When the engine sees the directive, it preserves encapsulation. Add the lwc:dom="manual" directive to an empty native HTML element. The owner of the component calls appendChild()
Communications between Lightning Components : Salesforce Salesforce have new lightning framework to create components in lightning framework which is fast with high performance to pass data from one lightning component to another. For this salesforce provides various ways to communicate between lightning components. Below are the list of ways you can communicate :- 1. Using attribute in lightning components. 2. Using aura:method to pass data. 3. Using component type event. 4. Using application type event. 5. Using System Events. 1. Using Attributes :- we have a parent component in which we have a Boolean attribute which i want to pass to child component for further processing. c:parentComponent.cmp <aura:component> <aura:attribute name=”showTable” default=”false” type=”boolean”/> <lightning:button label=”show table” onclick=”{! c.showBoolean }” /> <c:childComponent tableDisplay=”{!v.showTable}”/> </aura:component> c:parentCompone
Comments
Post a Comment