Skip to main content

Notifications

Customer experience | Sales, Customer Insights,...
Suggested answer

How to Add a new record to an entity on adding a record to a subgrid

Posted on by 80

Hi,

we have a requirement that we need to add a record to an entity when we add a record to a subgrid using the (+) button.

1. We have a subgrid on opportunity record

2. Plus (+) button on the subgrid adds the contacts to the grid.

Now we want to add another record to a custom entity along with the above record addition to the subgrid.

Is there a a way that we can achieve the above functionality? Please suggest.

Thanks,

Venu

  • Suggested answer
    Roma Gupta Profile Picture
    Roma Gupta 725 on at
    RE: How to Add a new record to an entity on adding a record to a subgrid

    Hi

    I would also recommend to write a C# plugin. But you need to do multiple testing just as explained by Evgeniy.

    EX. If you want to distinguish between different type of contact records you would have to add a flag or something. So you have to think of all possible filters if required.

    Regards

    Roma

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: How to Add a new record to an entity on adding a record to a subgrid

    I would also suggest to write a C# plugin, since that is the most performant option.

    On the other hand you could try to build a workflow which will trigger on the creation of a contact record.

    But keep in my mind that, just as Haris Lilic mentioned, looking at any of this options, in a basic build you would trigger on ANY contact record creation.

    You need to reconsider all you options to build in conditions in your logic (whether its a workflow or a plugin).

    For example: In your C# plugin you could check whether the opportunity that this contact is added to, already has "such a custom entitiy record" and if not return the plugin (quit).

    Or check whether this contact is related to an opportunity at all. Because maybe some user might add a new contact from outside an opportunity and maybe you do not want to create that custom entity record in this occasion.

    Best wishes,
    Evgeniy

    Please mark this answer as verified if it helped solving your issue.
    Happy Developing.

  • Suggested answer
    Haris Lilic Profile Picture
    Haris Lilic 125 on at
    RE: How to Add a new record to an entity on adding a record to a subgrid

    You could write C# plugin to create the custom entity record that runs on CREATE of a contact record.

    Just have to be mindful that the plugin would fire every time a contact record gets created.

    Link on how to create and register Plug-Ins:

    docs.microsoft.com/.../tutorial-write-plug-in

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,253 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,188 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans