web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Customer experience | Sales, Customer Insights,...
Answered

How To Create a Plugin Oncreate For Search , Set and Control Attributes to some Entities

(1) ShareShare
ReportReport
Posted on by 10

Hi, I have the Dynamics 365 trial, I create a new Solution with new Entities end new Attributes to the Out Of the box Entities

I want to create a Plugin for a custom entity.

The entity is called WorkActivity, it has a lookup with another custom entity called Project and Project have a lookup with Account

I want the plugin control (OnCreate) if there's an Order associated with the same Account set in the Project's Account lookup, with a custom attribute (on Order) set to true.
If the plugin found it, I want to change the record and add a lookup (On WorkActivity) with the first-order found.
When the record change, the plugin control if the number of WorkActivity associated with the Order is greater than a custom (number) Attribute (added to Order)

I do not know where to begin.

I'm Italian, sorry for my bad English.

Thanks

I have the same question (0)
  • Verified answer
    SergioMarques Profile Picture
    Microsoft Employee on at

    Hello Samuele,

    I think it will be easier to perform the whole operation with the visual aid of a schema.

    If I understood your schema correctly:

    WorkActivity(lookup) <---- Project(lookup) <---- Account ----> Order(lookup) ----> WorkActivity(lookup)

    At this point, you might need two plugins.

    Create plugin (registered in WorkActivity) in PreOperation:

    - Extract the lookup value to Project from the "Target" and retrieve the Account lookup value [Column] from the Project record [Entity to query]

    - Having the Account entity reference, query orders that have this account (QueryExpression) that have the custom attribute set to true

    - If the entitycollection > 0 -> populate the lookup field in WorkActivity with that order entity reference

    ==

    For the second part, regarding the record change control, you should need a plugin on update, but I couldn't understand what you are trying to achieve.

    Hope this helped clearing up the whole scenario.

  • Samuele Profile Picture
    10 on at

    Thanks, i resolve.

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the April Top 10 Community Leaders

These are the community rock stars!

Leaderboard > Customer experience | Sales, Customer Insights, CRM

#1
ManoVerse Profile Picture

ManoVerse 101 Super User 2026 Season 1

#2
11manish Profile Picture

11manish 83

#3
Muhammad Shahzad Shafique Profile Picture

Muhammad Shahzad Sh... 69 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans