Dynamics CRM Entity to be owned by person or company - dynamics-crm

I have the below requirement -
We have an entity named Garden. A garden is owned by a person or company, and can also be leased by one or more people or companies. Each garden has a unique number.
Ideally, we would want to be able to see a single grid of all the people that own and/or lease the garden, regardless of whether they are a person or a company.
Questions -
1) Which entity to choose for person -> User or Contact
2) Which entity to choose for company?
3) How to design record ownership or leasing of garden?

This is a broad question, I’ll try my best.
Fact: We don’t have an option today to create a custom polymorphic entity - to capture/store multiple types of entities. There are some available OOB entities - Customer to store Account/Contact, Owner to store User/Team, Activity Regarding to store any Activity enabled entities.
If you look at Bookable Resource entity, even MS store the type like User or Equipment & respective lookup records separately. This is what you need exactly. Read more
1) Which entity to choose for person -> User or Contact
2) Which entity to choose for company?
User (owner) in case you need security around the ownership of the records. Then company has to be the Teams, because you mentioned Garden maybe owned by Person or Company. How many records you’re going to manage and are they going to get login in CRM?
You may have to look at PowerApps (Dynamics) portals which gives B2B, B2C options to control records ownership by Accounts/Contacts.
3) How to design record ownership or leasing of garden?
Partially answered in the above points. For leasing, you can have multiple subgrid (1:N) relationship. If required, you may need a custom component or web resource to pull the multiple type of owned/leasing records by UNION the results & render as a grid.

Related

How to filter data in CDS(powerapps) to restrict unauthorized users

I have created a custom entity in common data services(CDS) that streams in data from a survey.
I'll however need to give access to the data to various people. In my dataset, I have a column called community, which should represent which people have access to what data based on the community they've entered the column.
How exactly can I filter the data, after it has streamed in to ensure I only give access to people of a particular community. And yes every community is exclusive, no two people can be in two different communities.
I want to filter by the community, such that those in community A see only A and not B or C.
There’s no straight one step OOB configuration to achieve this. Because the row level security depends on the column value ie. community field value of each record.
One way is to create owner teams and add the users to right teams, then the custom entity record has to be owned by respective team - owner team of each custom entity record can be filled/assigned automatically based on the community field value on create using plugin/workflow/Flow.
Most important, in security role for that custom entity - read privilege has to be given only for user level. Assign the security role to Teams.

Dynamic parameters for views in Dynamics 365

I have a Account Relationship entity with two lookup fields called Recipient Account and Guide Account. I would like to be able to go on an Account and see all records where the Account Relationship's Recipient Account and Guide Account are set to the account I'm viewing.
In CRM, I can definitely create a view to fetch all account relationships on the Account Relationship entity and then inside the Account entity's form I can include the view with the data source set to Related Records Only and the entity set to Account Relationship (Recipient Account). But I can't do both in a single view.
Through what mechanism can I have it all be in one view? One thing I was considering was creating separate grids, one for Recipient Account and another for Guide Account. But I want to know if there is a mechanism where I can combine all records that have "Recipient Account = Current Account or Guide Account = Current Account" that is basically the query I want to run.
You could use connections. It's pretty flexible and will fulfill your needs as long they stay simple. That's the only viable option I see aside from using two views.
Keep only one subgrid of Account Relationship N:N intersect entity (either Guide account or Recipient account relation)
Register RetrieveMultiple pre-operation plugin to intercept the query & pass the custom fetchxml query by incorporating or filter
Fetchxml has to be built something like explained
Try this unrecommended if you wish but two grids are better choice. This alternate solution also you can try.

Displaying Lead Activities in Contact's Social Pane

In our system, some contacts are linked to the leads later in the process, therefore those contacts don't have the Originating Lead (originatingleadid). Also, we want to connect some contacts to multiple leads.
Currently, we are connecting contacts and leads through the Parent Contact for Lead field (parentcontactid in lead entity).
But the problem is that if the contact does not have an Originating Lead, the activities from the lead are not displayed in the contact's social pane. The relation made through parentcontactid field is ignored.
Is there any workaround for this? Is it possible to make such a relation between the contact and the lead that the activities from the lead are displayed in the contact's social pane?
The originatingleadid field is not valid for update, it can be set only on create.
You can change the Rollup View Relationship Behavior on custom 1:N relationships to Cascade All. In this way the activities from children will be shown on the activity view for the parent.
This would require you to create a custom relationship between Contact and Lead, since you cannot change this property on the standard relationships in the system.
You have not specified a version. The Rollup View Relationship Behavior was added in Dynamics 365 (version 8.2).

Show only user specific team activities

Lets say
User A belongs to Team X and Team Y
User B belong to Team X
User C belongs to Team X
I want to create a view to display only activities owned by users belonging to Team X and not belonging to both Team X&Y. That result set should only display activities belonging to User B&C.
I created a view but it shows activities of user A as well.
Advance Find
I think you probably want one of these 'equals current user...' options.
Or perhaps simply this - you can enter multiple users.
You also have to keep in mind Security roles and how they impact your views. If you are a SysAdmin, your views will not be filtered at all by ownership - only the criteria you put into the view. If you have a view where "Owner = Team A", then SysAdmin would see all those records where Owner = Team A. If you have a less-permissed user (say, they only have USER LEVEL read on the entity), and the view is "Owner =Team A" - they'd only see records in that view if they belonged to Team A.
It is important to know that User ownership is a mirror of Team ownership. So, User level read actually lets me see ALL records that I own or MY TEAMS own, that satisfy your filter criteria.
Above answer should work - I would use "Equals Current User or User's Teams" but again, depends on exactly what you are trying to do and how everything is setup in CRM

CRM Dynamics Contact sub-types

I am very new to Dynamics. I'm trying to figure out if I can use dynamics to create sub-types of the contact entity which have all the common attributes and relationships of the contact entity but each has their own specific attributes as well.
I am thinking about this in an object oriented frame of mind but cannot see how this could be accomplished in Dynamics.
As an example say I was managing schools in a region and I had 3 types of contacts in the system:
School Teachers
School Administrators
School Pupils
All of these would share the attributes from the contact entity but teachers and administrators would have some employee specific attributes and students would have some student specific attributes.
Can someone give me an example of how to accomplish this?
You could set up a picklist on the contact entity with the different "types" on contacts there were. Then attach some javascript to that attribute, so that when it changes, it shows/hides the extra type-specific fields you've defined.
In SAP there are diffrent Roles for a Business Partner (Contact in your example) maybe its similar in the ms crm, but thats just a clue.

Resources