Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <aura:application>
- <aura:attribute name="accId" type="String"/>
- <aura:attribute name="oppId" type="String"/>
- <c:CreateRecord accountId="{!v.accId}" opportunityId="{!v.oppId}"/>
- <aura:dependency resource="markup://force:*" type="EVENT"/> <!--When I didn't include this, it errored-->
- </aura:application>
- <aura:component>
- <aura:attribute name="opportunityId" type="String"/>
- <aura:attribute name="accountId" type="String"/>
- <aura:handler name="init" value="{!this}" action="{!c.doInit}"/>
- </aura:component>
- ({
- doInit : function(component, event, helper){
- var createRecordEvent = $A.get("event.force:createRecord");
- createRecordEvent.setParams({
- entityApiName: "Custom_Object__c"
- , defaultFieldValues: {
- Opportunity__c: component.get("v.opportunityId")
- , Account__c: component.get("v.accountId")
- }
- });
- //These are being populated correctly
- console.log(component.get("v.opportunityId"));
- console.log(component.get("v.accountId"));
- createRecordEvent.fire();
- }
- })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement