You need to sign in to do that
Don't have an account?
Alex P
Lightning component that creates a new quote from the Opportunity
I was hoping someone could assist me with a Lightning Component quick action. I am trying to make a quick action on the Opportunity to create a new quote. The only field I am looking to show is the quote name field. I have the button but when I click the "Create Quote" nothing happens. I am very new to the dev side of SFDC and I gleamed all the code from research. Can anyone take a look at my code and see whats up?
Component: <aura:component controller="QuickQuote" implements="force:lightningQuickActionWithoutHeader"> <aura:attribute name="recordId" type="String" /> <aura:attribute name="newQuote" type="Quote"/> <div class="slds-page-header" role="banner"> <h1 class="slds-page-header__title slds-m-right--small slds-truncate slds-align-left">Create New Quote</h1> </div> <lightning:input aura:id="quoteName" name="Quote Name" label="Quote Name" value="{!v.newQuote.QuoteToName}" required="true"/> <lightning:button label="Create Quote" onclick="{!c.createQuote}" class="slds-m-top--medium"/> </aura:component> Controller: ({ createQuote: function(component, event, helper) { var saveAction = component.get("c.saveQuote"); console.log('saveAction'); saveAction.setParams({ newQuote: component.get("v.newQuote"), oppId: component.get("v.recordId") }); saveAction.setCallback(this, function(response) { var state = response.getState(); console.log('state'+state); if(state === "SUCCESS") { var resultsToast = $A.get("e.force:showToast"); resultsToast.setParams({ "title": "Quote", "message": "Quote Creation is Success." }); $A.get("e.force:closeQuickAction").fire(); resultsToast.fire(); $A.get("e.force:refreshView").fire(); } else if (state === "ERROR") { var errors = response.getError(); if (errors) { if (errors[0] && errors[0].message) { console.log("Error message: " + errors[0].message); } } else { console.log("Unknown error"); } } }); console.log('En Quier action '); $A.enqueueAction(saveAction); }, handleCancel: function(component, event, helper) { $A.get("e.force:closeQuickAction").fire(); } }) Apex: public class QuickQuote { @AuraEnabled public static boolean saveQuote(Quote newQuote, Id oppId) { system.debug('newQuote'+newQuote); newQuote.OpportunityId = oppId; try{ insert newQuote ; return true ; }catch(Exception e){ if (true) { throw new AuraHandledException(e.getMessage()); } return false ; } } }