Master Yoda
Master Yoda

Reputation: 4422

Create records for mapped entities when parent form is saved

I have a custom parent entity named Artist which has a child entity named Album that I need to map to it. It would be an (Artist)1:M(Album) relationship in that instance.

Currently, on the artist form I have created a quick create form for adding albums to a subgrid. When I click save on the quick create form it creates the album. When user updates the "Finished" field on the Artist form and saves, I need to create an **AlbumSummary* record for each album associated with the Artist.

Im new to dynamics so not sure how to do this or if its even possible to do Out of the box.

enter image description here

Upvotes: 1

Views: 196

Answers (2)

Daryl
Daryl

Reputation: 18895

At the simplest form within Dynamics CRM, it's all about understanding what your triggering events are, and what actions you'd like to take. In your case, you've stated your triggering event is the user updating the "Finished" field on the Artist form. This feels like a bit of a code smell here. Just not sure what "Finished" means for an Artist. Most likely, you want this logic to take place either each time the user adds an album, in which case it would be the creation of the album that should be your trigger. If you'd like your logic to kick in for every album, only when the user chooses, then you might think about creating a ribbon button for this purpose.

Once you've determined your trigger you have quite a few options for performing your actions. Simplest for developers are creating plugin, that you deploy and register to run on the particular event (create/update) of the particular entity/attribute. Simplest for non developers would be a MS Flow (if online) or a Workflow.

So to answer your question, yes, it's supported, just with some supported custom logic.

Upvotes: 0

Sergey Tunnik
Sergey Tunnik

Reputation: 448

This is definitely possible in Dynamics.

I suppose you would like to go 'no code' approach. Taking you data model in mind, this can't be easily done using workflows (https://learn.microsoft.com/en-us/dynamics365/customerengagement/on-premises/customize/workflow-processes). Cause they don't do well on working with relationships. There are no queries and cycles through result records in workflows.

Your example may be a bit abstract, but still let's consider some business logic changes that make it possible to use workflows.

  1. If it is one-to-one relationship between Album Summary and Album, then you can just incorporate that summary data in Album itself. And not use Album Summary entity at all.

  2. Album Summary may be easily created on Album creation event. Also doesn't fit well exactly your requirements.

If these are not an options for you, then you will have to go with code approach. You will need to develop plugin or WF activity in C#.

If you are using D365 online with good license plan you can investigate Power Automate (no code) usage.

Upvotes: 1

Related Questions