Place the NPSP Opportunity Action Rail right above the Opportunities related list on your Contact Lightning Page. The buttons will open up the Create Record modal for Opportunity with the Primary Contact & Account pre-populated. It uses the default record type, and your full page layouts (not a quick action!)
Last active
August 25, 2017 19:44
-
-
Save cdcarter/7f1b0dedfa8484afb0d7499f4aca0cd6 to your computer and use it in GitHub Desktop.
NPSP Opportunity Action Rail
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<aura:component implements="flexipage:availableForRecordHome,force:hasRecordId" access="global" > | |
<aura:attribute name="simpleContact" type="Object" access="private"/> | |
<force:recordData fields="AccountId, npsp__Primary_Affiliation__c" | |
mode="VIEW" | |
recordId="{!v.recordId}" | |
targetFields="{!v.simpleContact}"/> | |
<div class="container forceRelatedListSingleContainer"> | |
<lightning:card iconName="standard:opportunity"> | |
<aura:set attribute="title"> | |
<h2><b>NPSP Donation Actions</b></h2> | |
</aura:set> | |
<aura:set attribute="actions"> | |
<lightning:buttonGroup > | |
<lightning:button label="New Contact Donation" onclick="{!c.fireContactOppty}"/> | |
<lightning:button label="New Primary Affiliation Donation" onclick="{!c.fireAccountOppty}"/> | |
</lightning:buttonGroup> | |
</aura:set> | |
</lightning:card> | |
</div> | |
</aura:component> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
({ | |
fireContactOppty : function(component, event, helper) { | |
helper.createOppty(component, component.get('v.simpleContact.AccountId')); | |
}, | |
fireAccountOppty : function(component, event, helper) { | |
helper.createOppty(component, component.get('v.simpleContact.npsp__Primary_Affiliation__c')); | |
} | |
}) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
({ | |
createOppty : function(cmp, accountId) { | |
var createOpptyEvent = $A.get("e.force:createRecord"); | |
createOpptyEvent.setParams({ | |
"entityApiName": "Opportunity", | |
"defaultFieldValues": { | |
'npsp__Primary_Contact__c' : cmp.get('v.recordId'), | |
'AccountId' : accountId, | |
'Name' : 'This will be replaced by NPSP Naming.' | |
} | |
}); | |
createOpptyEvent.fire(); | |
} | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment