Breaking news from around the world
Get the Bing + MSN extension
Now Available in Community - MBAS 2019 Presentation Videos
Catch the most popular sessions on demand and learn how Dynamics 365, Power BI, PowerApps, Microsoft Flow, and Excel are powering major transformations around the globe. | View Gallery
2019 release wave 2 Discover the latest updates to Dynamics 365Release overview guides and videos Release Plan | Early Access Availability
Ace your Dynamics 365 deployment with packaged services delivered by expert consultants. | Explore service offerings
Connect with the ISV success team on the latest roadmap, developer tool for AppSource certification, and ISV community engagements | ISV self-service portal
The FastTrack program is designed to help you accelerate your Dynamics 365 deployment with confidence.
FastTrack Program | Finance TechTalks | Customer Engagement TechTalks | Talent TechTalks | Upcoming TechTalks
When a user sets the "Scope" on an Opportunity record to "Parent Opportunity", a grid appears that allows the user to create child Opportunity records associated with the parent. I am trying to create a web resource for an OnLoad event that will auto-populate the Opportunity Name, Contact, and Account of the QuickCreate form with the data that is in the Parent Opportunity form. Account and Contact are lookups to separate entities, and Opportunity Name is a text field. Here is what I have so far:
var formContext = executionContext.getFormContext();
var account = formContext.getControl("ParentAccountId").getAttribute().getValue();
var contact = formContext.getControl("ParentContactId").getAttribute().getValue();
var oppname = formContext.getControl("new_name").getAttribute().getValue();
The easiest way to do this is using a no-code solution, and just adding entity mapping.
When you create a new record from an existing record there is a relationship that exists between both records. You can set the mapping between the relationships of the entities.
See the example blog post below, which provides step by step directions of doing this.
Hope this helps.
I believe that the code above in your post is for populating field in the opposite way and I think it is not supported.
As suggested by Aric, you can use entity mapping to auto-populate fields from Parent record. However, this method will not work unless you are creating the child record from within the Parent record directly.
What I suggest is No-code solution
1. In the quick create form, display only the parent lookup field
2. Create a synchronous workflow that will be triggered on the creation of the child record
3. In the workflow designer, add a step to update the fields of the child record based on the Parent record fields
4. Display the fields in the update form of the child record
In addition, follow the below links to help you achieve your need:
I am a little confused. Both the parent and child Opportunities are coming from the Opportunity entity, so I'm not sure if there is a relationship to create. Will the solution you suggested still work?
Sorry, I see what you mean now. Your suggestion worked, thank you!!
I do have one more question related to this: Will creating these mappings affect previously created 'Child Opportunity' records? I do not want that to happen. I'm hoping it'll only auto-populate fields for new records being created. Is that the case?
It will not affect old records, but the new ones
Business Applications communities