Skip to content

Instantly share code, notes, and snippets.

@choudharymanish8585
Last active February 17, 2019 22:33
Show Gist options
  • Save choudharymanish8585/4f32da34710ee3ced2ebb19631eab0d3 to your computer and use it in GitHub Desktop.
Save choudharymanish8585/4f32da34710ee3ced2ebb19631eab0d3 to your computer and use it in GitHub Desktop.
({
doInit : function(component, event, helper) {
var createBoatRecord = $A.get("e.force:createRecord");
if(createBoatRecord){ //check if this event is available or not
component.set("v.showNew", true);
} else{
component.set("v.showNew", false);
}
helper.getCarType(component, helper);
},
createRecord : function(component, event, helper) {
var createCarRecord = $A.get("e.force:createRecord");
//getting selected picklist value
var carTypeId = component.find("carType").get("v.value");
carTypeId = carTypeId.length != 0?carTypeId:null;
console.log('carType--'+carTypeId);
debugger;
//This line sets parameter value to system event
createCarRecord.setParams({
"entityApiName": "Car__c",
"defaultFieldValues": {
"Car_Type__c" : carTypeId
}
});
//This line fires system event
createCarRecord.fire();
},
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment