Skip to main content

Notifications

Microsoft Dynamics CRM (Archived)

Contacts -> Javascript to restrict to display only one view for Owner lookup field

Posted on by 160

Hi All,

My Business case is, user should be able to manually assign a team as an owner for a contact record, if they are part of more than 1 team. As it's always team will be a owner and they should view only the team they are part of, I am expecting below behavior.

When an user clicks on the "Owner" lookup field, the entity should be locked to "Teams" and the view should only be "My Teams".

I guess, this can only be done through javascript and as I am not developer myself, can anyone share a generic javascript (if already available), so that I can manipulate it and make it work?

Thanks,

Praveen.

*This post is locked for comments

  • Verified answer
    RaviKashyap Profile Picture
    RaviKashyap 55,410 on at
    RE: Contacts -> Javascript to restrict to display only one view for Owner lookup field

    Hi Preveen,

    For restricting the view to My Team view only, you can change the field properties. Refer screenshot below-

    team2.png

    team2.png

  • Verified answer
    RaviKashyap Profile Picture
    RaviKashyap 55,410 on at
    RE: Contacts -> Javascript to restrict to display only one view for Owner lookup field

    Hi Praveen,

    You need to use Ribbon Workbench to hide the assign button.

    You can refer this thread fro the steps. Do not that you do not uncustomize after hideing it (as mentioned in the answer).

    community.dynamics.com/.../186299

    Hope this helps.

  • Suggested answer
    Adrian Begovich Profile Picture
    Adrian Begovich 21,009 Super User 2024 Season 2 on at
    RE: Contacts -> Javascript to restrict to display only one view for Owner lookup field

    Hi Praveen Kumar Ellappa,

    After creating the lookup field to the team entity, you can modify the field properties so that the default view on the lookup field is set to "My Teams" and the view selector is set to off.

  • RE: Contacts -> Javascript to restrict to display only one view for Owner lookup field

    Arun,

    I am going for option 3. Is there a way to restrict users to view and select only the teams they are part of; i.e. only My Teams view should be there?

    Regards,

    Praveen.

  • Verified answer
    Arun Vinoth Profile Picture
    Arun Vinoth 11,613 on at
    RE: Contacts -> Javascript to restrict to display only one view for Owner lookup field

    You can try any one of the options Guido recommending in this thread: community.dynamics.com/.../180992

    Other choices discussed here: community.dynamics.com/.../157459

  • RE: Contacts -> Javascript to restrict to display only one view for Owner lookup field

    Ravi,

    Should we hide the Assign command using XRM toolbox?

  • RE: Contacts -> Javascript to restrict to display only one view for Owner lookup field

    Hi Ravi,

    Thanks for you answer. Let me implement your recommendation and see how our team responds to it.

    Regards,

    Praveen.

  • Suggested answer
    RaviKashyap Profile Picture
    RaviKashyap 55,410 on at
    RE: Contacts -> Javascript to restrict to display only one view for Owner lookup field

    Update

    Instead of Business Rule, you need to use real time workflow to assign the record to the team. In Business Rule, the field doesn't appear to set on owner field.

    Hope this helps.

  • Verified answer
    RaviKashyap Profile Picture
    RaviKashyap 55,410 on at
    RE: Contacts -> Javascript to restrict to display only one view for Owner lookup field

    Hi,

    I think the easiest (no code) way would be this-

    1. Create a new custom field "Owner (Team)" which would be a look up to Team entity. Make it mandatory

    2. Hide the OOB "Owner" field.

    3. Create a Business Rule which populated the values from "Owner (Team)" to "Owner" field always.

    4. You may also need to hide the "Assign command" if it is available to user as this can also change the owner.

    Hope this helps.

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