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

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Dynamics 365 Community / Blogs / MayankP’s Blog / Dynamics 365: Setting up Ow...

Dynamics 365: Setting up Owner look up to display only teams related to logged on user

Mayank Pujara Profile Picture Mayank Pujara 830

Dynamics: Setting up Owner to display only teams related to logged on user

By default, dynamics model driven app Form owner field displays all users and teams and this post we will write JavaScript code for specific entity (table) to ensure users can only pick teams (where current logged on user is a member of the team)

Step 1: Firstly, there is already existing view called “My Owner Teams”, which displays all teams related to logged on user, so we will do advanced find for this view and find id of this view which will be using in next step.

select view which needs to be set as default view

After creating this view download FetchXML and note down view id for this, if you have specific requirement then create new public view and use that record id in next step.

Step 2:  Now we will create new web resource which will filter our owner field on model driven table form to only display teams which are related to logged on user.

For this we will create new java script web resource as shown in screen print below.

new web resource

And following is code that we will put in this JavaScript file.

The source code file for above code is located at https://github.com/contactmayankp/miscellaneousscripts

Step 3: Add form load event on model driven form.

Add this web resource as library in the form

And then configure onload event as shown in screen print below.

After doing this configuration, save and publish form changes..

Step 4: Ensure relevant team got correct security role and permission assigned other wise user might see following error message.

The selected team does not have sufficient privileges for this action. Assign a security role with the required privileges to this team, and then try again.

Step 5: Finally, after doing all above changes verify the changes working as expected …

Hope this helps…


This was originally posted here.

Comments

*This post is locked for comments