Component:
Component Controller:
Output:
- <aura:component >
- <div class="slds-box slds-theme_default">
- <lightning:recordEditForm objectApiName = "Opportunity"
- onsuccess = "{! c.handleSuccess }">
- <lightning:inputField fieldName="Name" />
- <lightning:inputField fieldName="StageName" />
- <lightning:inputField fieldName="CloseDate" />
- <lightning:inputField fieldName="AccountId" />
- <lightning:button class="slds-m-top_small"
- variant="brand"
- type="submit"
- name="update" label="Update" />
- </lightning:recordEditForm>
- </div>
- </aura:component>
Component Controller:
- ({
- handleSuccess : function(component, event, helper) {
- var params = event.getParams();
- alert(params.response.id);
- }
- })
Output:
how to get recordId from JSON.stringify(compEvent.getParam("accountByEvent"))); , It is showing Id and name in JSON format, i need to retrieve recordId from this without using recordeditform. please help me
ReplyDelete({
selectBoat : function(component, event, helper){
// get the selected Account from list
var getSelectAccount = component.get("v.boatname");
var compEvent = component.getEvent("oSelectedBoatEvent");
// set the Selected Account to the event attribute.
compEvent.setParams({"accountByEvent" : getSelectAccount });
alert('getParams'+JSON.stringify(compEvent.getParam("accountByEvent")));
var payload = compEvent.getParams();
alert('testparams' +payload.response);
compEvent.fire();
//helper.selectBoatHelper(component, event, helper);
},
})
Don't use JSON.stringify().
DeleteUse compevent.getParam("accountByEvent").Id.