Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics CRM (Archived)

Can't use the privileges or javascript to hide the "New" button on the lookup

(0) ShareShare
ReportReport
Posted on by 1,530

Hi,

(Using Microsoft Dynamics® CRM 2016(8.1.0.359) (DB 8.1.0.359))

I have an issue that I am not sure how to resolve.  I have a lookup that I need to be able to remove or hide the "New" button.

The reason why I need to remove this button is because I have a form that allows a user to create code data (sub grid) that is related to the same entity.  For example:

I have a Model entity and Case Entity.  The Case Entity is use to allow a user to add the model records that can be used for the Case.

Once the user has added the models for the case.  I have a sub grid that is used to allow adding additional information for the Case / Models.   So base on the below image I have 3 models that the user can only select from.  I do not want the  user to try and create new models because that data is controlled. 

8686.Lookup.JPG

I have read many postings and the final out come is to control this by using privileges.  I have also seen where people have logic that has been created to handle the DOM.  I have tried a few and had no luck getting the logic to work.

Here's my only options that I can think of in getting this to work.

1) Use javascript that is able to somehow disable or hide the button.

2) Use javascript that can control the privileges for disabling the "create" option.  The privileges would change dynamically.

Does someone have any logic or example on how I can get this to work.

*This post is locked for comments

  • 365-Assist Profile Picture
    365-Assist 19 on at
    RE: Can't use the privileges or javascript to hide the "New" button on the lookup

    Hi All,

    I have the exact same problem. Has there been any updates changes in the last couple of years? Not I am using Dataverse Model Driven PowerApps.

  • Verified answer
    Ben Thompson Profile Picture
    Ben Thompson 6,350 on at
    RE: Can't use the privileges or javascript to hide the "New" button on the lookup

    There will be in the future. The custom control framework will allow you to create custom controls that exactly meet your requirements. You will just need someone who understands React to build them for you...

  • rthompson Profile Picture
    rthompson 1,530 on at
    RE: Can't use the privileges or javascript to hide the "New" button on the lookup

    Hi Mahen,

    I know.

    I am trying to come up with another way.

    Now I need to hide "Look Up More Records".  I wish there were setting to turn this off or on.

    2211.Lookup.JPG

  • Mahendar Pal Profile Picture
    Mahendar Pal 45,095 on at
    RE: Can't use the privileges or javascript to hide the "New" button on the lookup

    Ok but keep in mind this also unsupported code.

  • rthompson Profile Picture
    rthompson 1,530 on at
    RE: Can't use the privileges or javascript to hide the "New" button on the lookup

    Hi Mahen,

    I found this example to help me fix my issue.   https://community.dynamics.com/crm/f/117/t/244068

    //to disable Lookup create new button
    function DisableCreateNewLookupButton(lookupFieldName) {
        // To hide "New" button – Post UR 13
        var h1 = window.parent.document.getElementById(lookupFieldName);
        h1.setAttribute("isinlinenewenabled", 0);
    }


  • rthompson Profile Picture
    rthompson 1,530 on at
    RE: Can't use the privileges or javascript to hide the "New" button on the lookup

    Hi Mahen,

    Thanks for the feedback.

    I am not having any luck with adding this to the form xml.   parameter node <IsInlineNewEnabled>false</IsInlineNewEnabled>.

    How do I do this?

    And do I use javascript to assign the value?

  • Suggested answer
    Mahendar Pal Profile Picture
    Mahendar Pal 45,095 on at
    RE: Can't use the privileges or javascript to hide the "New" button on the lookup

    Hi,

    As you already gone through many forum threa, so first thing you need to understant only supported option is throgh the security roles, but this will not just hid new button from the lookup popup but from everywhere for the user.

    And if you are ready for the unsupported changes, which can break any time when you will do the upgrade/update, you need to play with the DOM or you can try to use this approach by injecting into the XML file

    "n your customization xml take the form control and add a parameter node <IsInlineNewEnabled>false</IsInlineNewEnabled>

    Normally it's only for internal use and unsupported but since there is no supported way to do it...

    Note that it will only be the inline new that will be hidden, not the new button when you open the lookup for more records."

    Reference: community.dynamics.com/.../143994

    But keep in mind first try this on the trial or demo environment because you need to be very careful and it can break your environment if not done properly.

    Hope it will help !!

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,280 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,235 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans