Can't add users to other Teams - dynamics-crm

I have a team in crm dynamics 365 and the isdefault = true in the team, how can I understand where create teams with the isdefault = true flag and where they are filled with users?
If I try create team, the isdefault = false flag.

In CRM, we have a default Business unit for each organization and we can create child BU structure under this parent BU. Each Business unit will have a default BU Team (owner) and it will get all the users in that BU as members. This is what you are referring isdefault = true team. Whenever users BU changed, they will move accordingly. This has huge security implications. Examples: Sales, Sales-APAC, Service, etc
You can also create an owner Team, this will be isdefault = false and users can be added/removed based on need. This can also own records, ie records can be assigned to this owner team.

Related

Automatically assign records after 1 day in MS Dynamics CRM

I would like to implement a functionality in MS CRM-
When a user changes a department, record owned by him should be automatically assigned to department owner after 1 day. How to achieve this functionality in Microsoft Dynamics CRM ? By some plugin or workflow ?
Assuming you have some type of lookup for Department (1:1 relationship with SystemUser, I would use Power Automate to solve this.
Put the flow on the system user entity, filtered for when column Department changes. When that happens, use Dataverse connector and pull owner of previous Department, re-assign existing records for types (tables) x, y, z.

Dynamics CRM Entity to be owned by person or company

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.

Implementing row based access based on role

I have created a table that contains Ticket information, with an id, message body, user id and department id.
I would like to be able to limit access to these tickets, such that only users from the corresponding department can access the relevant tickets, and can not view other department's tickets.
I have attempted to make an updatable view for each department and granting select on this, but it does not work very well.
Is there a simple way to achieve this kind of role based access?

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

Setting CRM User's Manager: Error UserNotInParentHierarchy

I wrote a script (VBScript) to create/update CRM users based on an external MySQL database. Everything works great except for automatically setting the user's manager. In the MySQL database, each user has a unique ID and a reports_to field with the ID of his manager if any.
In the CRM, a custom field in the SystemUser table contains the unique user ID from the external table. This way, by looking at the external reports_to field I can link a CRM User to another. The worst part is that it actually works for some users, until it reaches one that brings an error: "The user is not in parent user's business hierarchy." Can someone explain me what this error is about ? I could not find any details or similar cases on the Internet.
I can manually set the Manager for this user in the CRM and it does not give me any error.
Here is my code:
Dim ManagerUser As New SystemUser
ManagerUser = GetUser("tld_id", clrint(User._reports_to), _serviceProxy)
If Not IsNothing(ManagerUser) Then
Dim ManagerId As Guid = ManagerUser.Id
Dim Manager = New SetParentSystemUserRequest
Manager.ParentId = ManagerId
Manager.UserId = _UserId
Manager.KeepChildUsers = True
_serviceProxy.Execute(Manager)
End If
Ok I found what it meant.
Some Business Units in the CRM are Parents from others. I was working with a DEV MySQL table (still test phase) that had unclean data. It resulted in some users having the wrong BU set.
Error was triggered when the manager belonged to a BU child from the user's one.

Resources