Advertisement
Guest User

Untitled

a guest
Jun 20th, 2019
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.12 KB | None | 0 0
  1. <aura:application>
  2. <aura:attribute name="accId" type="String"/>
  3. <aura:attribute name="oppId" type="String"/>
  4. <c:CreateRecord accountId="{!v.accId}" opportunityId="{!v.oppId}"/>
  5. <aura:dependency resource="markup://force:*" type="EVENT"/> <!--When I didn't include this, it errored-->
  6. </aura:application>
  7.  
  8. <aura:component>
  9. <aura:attribute name="opportunityId" type="String"/>
  10. <aura:attribute name="accountId" type="String"/>
  11. <aura:handler name="init" value="{!this}" action="{!c.doInit}"/>
  12. </aura:component>
  13.  
  14. ({
  15. doInit : function(component, event, helper){
  16. var createRecordEvent = $A.get("event.force:createRecord");
  17. createRecordEvent.setParams({
  18. entityApiName: "Custom_Object__c"
  19. , defaultFieldValues: {
  20. Opportunity__c: component.get("v.opportunityId")
  21. , Account__c: component.get("v.accountId")
  22. }
  23. });
  24. //These are being populated correctly
  25. console.log(component.get("v.opportunityId"));
  26. console.log(component.get("v.accountId"));
  27. createRecordEvent.fire();
  28. }
  29. })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement