This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <aura:component implements="flexipage:availableForRecordHome,force:hasRecordId"> | |
| <aura:attribute name="recordError" type="String" access="private"/> | |
| <force:recordData aura:id="recordHandler" | |
| recordId="{!v.recordId}" | |
| fields="Id" | |
| targetError="{!v.recordError}" | |
| recordUpdated="{!c.handleRecordUpdated}" /> | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ({ | |
| validateContactForm: function(component) { | |
| var validContact = true; | |
| // Show error messages if required fields are blank | |
| var allValid = component.find('contactField').reduce(function (validFields, inputCmp) { | |
| inputCmp.showHelpMessageIfInvalid(); | |
| return validFields && inputCmp.get('v.validity').valid; | |
| }, true); | |
| if (allValid) { | |
| // Verify we have an account to attach it to |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ({ | |
| doInit: function(component, event, helper) { | |
| component.find("contactRecordCreator").getNewRecord( | |
| "Contact", // sObject type (objectApiName) | |
| null, // recordTypeId | |
| false, // skip cache? | |
| $A.getCallback(function() { | |
| var rec = component.get("v.newContact"); | |
| var error = component.get("v.newContactError"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <aura:component implements="flexipage:availableForRecordHome,force:hasRecordId"> | |
| <aura:attribute name="newContact" type="Object"/> | |
| <aura:attribute name="simpleNewContact" type="Object"/> | |
| <aura:attribute name="newContactError" type="String"/> | |
| <force:recordData aura:id="contactRecordCreator" | |
| layoutType="FULL" | |
| targetRecord="{!v.newContact}" | |
| targetFields ="{!v.simpleNewContact}" | |
| targetError="{!v.newContactError}" | |
| /> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ({ | |
| handleSaveRecord: function(component, event, helper) { | |
| component.find("recordHandler").saveRecord($A.getCallback(function(saveResult) { | |
| if (saveResult.state === "SUCCESS" || saveResult.state === "DRAFT") { | |
| // handle component related logic in event handler | |
| } else if (saveResult.state === "INCOMPLETE") { | |
| console.log("User is offline, device doesn't support drafts."); | |
| } else if (saveResult.state === "ERROR") { | |
| console.log('Problem saving record, error: ' + JSON.stringify(saveResult.error)); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <aura:component implements="flexipage:availableForRecordHome,force:hasRecordId"> | |
| <aura:attribute name="simpleRecord" type="Object"/> | |
| <aura:attribute name="recordError" type="String"/> | |
| <aura:attribute name="record" type="Object"/> | |
| <force:recordData aura:id="recordHandler" | |
| recordId="{!v.recordId}" | |
| layoutType="FULL" | |
| targetRecord="{!v.record}" | |
| targetFields="{!v.simpleRecord}" | |
| targetError="{!v.recordError}" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ({ | |
| updateCompanyStatus : function( cmp, event, helper ) { | |
| var actionAPI = cmp.find("quickActionAPI"); | |
| var fields = { Comapny_Status__c: {value:false}}; | |
| var args = {actionName: "SimplusLab__c.UpdateCompanyStatus", entityName: "SimplusLab__c", targetFields: fields}; | |
| actionAPI.setActionFieldValues(args).then(function(){ | |
| actionAPI.invokeAction(args); | |
| }).catch(function(e){ | |
| console.error(e.errors); | |
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <aura:component implements="flexipage:availableForRecordHome,force:lightningQuickAction" description="My Lightning Component"> | |
| <lightning:quickActionAPI aura:id="quickActionAPI" /> | |
| <div> | |
| <lightning:button label="updateCompanyStatus" onclick="{!c.updateCompanyStatus}"/> | |
| </div> | |
| </aura:component> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <aura:application extends="force:slds"> | |
| <c:lightningcomboBox/> | |
| </aura:application> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ({ | |
| handleChange: function (cmp, event) { | |
| var selectedOptionValue = event.getParam("value"); | |
| alert("Option selected with value: '" + selectedOptionValue + "'"); | |
| } | |
| }) |