Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics CRM (Archived)

How to hide / show new button inside lookup

Posted on by 40

Hi all

How to hide / show  new button inside lookup control  dependence option set control 

i can't use create privilege.

I used javescript 

function HideNewButtonFromLookUp(context)
{
var headcounttype= Xrm.Page.getAttribute("new_headcounttype").getValue();
if (headcounttype!= null) {
if (headcounttype== "Hiring") {
var lookupControl = Xrm.Page.data.entity.attributes.get(“new_employeename”).getValue();

if (lookupControl != null){
lookupControl._element._behaviors[0].AddParam(“ShowNewButton”, 1);
context.getEventArgs().preventDefault();
}
}
else {
lookupControl._element._behaviors[0].AddParam(“ShowNewButton”, 0);
context.getEventArgs().preventDefault();
}

}
}

*This post is locked for comments

  • Brekaa Profile Picture
    Brekaa 40 on at
    RE: How to hide / show new button inside lookup

    Hi Shidin Haridas

    sure , but now its work

  • Suggested answer
    Shidin Haridas Profile Picture
    Shidin Haridas 3,497 on at
    RE: How to hide / show new button inside lookup

    Brekka,

    The solution you mentioned may be a short-term fix as in a future release, these might break.

    So, for every release, you would need to test this piece of code to ensure that it has not broken.

  • Verified answer
    Brekaa Profile Picture
    Brekaa 40 on at
    RE: How to hide / show new button inside lookup

    Hi Goutam Das

    I solved it by javaScrpit

    this is Solve

      document.getElementById("LookUp Name").setAttribute("isinlinenewenabled", "0");

    Thanks,,

  • gdas Profile Picture
    gdas 50,085 on at
    RE: How to hide / show new button inside lookup

    HI Brekaa,

    I would suggest please ignore this type of requirement. I am also having same experience and waste lot of  time to keep customer commitment but at the end I realized that this type of requirement does not have any meaning.

    I believe  you know how to hide this using security roles , is there any specific reason  you are not using security roles ?

  • Brekaa Profile Picture
    Brekaa 40 on at
    RE: How to hide / show new button inside lookup

    Hi Shahbaaz Ansari

    Not working

  • Suggested answer
    Shahbaaz Ansari Profile Picture
    Shahbaaz Ansari 6,203 on at
    RE: How to hide / show new button inside lookup

    Hi,

    document.getElementsByClassName("ms-crm-InlineLookup-FooterSection-AddNew")[0].style.display = "none";

    Try using above line of code in console, and if works add in your code,

    please change the class name too,

    Refer : https://community.dynamics.com/crm/f/117/t/236723

    Thanks,

    Shahbaaz

  • Brekaa Profile Picture
    Brekaa 40 on at
    RE: How to hide / show new button inside lookup

    Hi Aric Levin

    I use javascript to solve it but not working

  • Brekaa Profile Picture
    Brekaa 40 on at
    RE: How to hide / show new button inside lookup

    Hi Abdul Wahab

    i saw this sites before

    and i can't any solved .

  • Aric Levin Profile Picture
    Aric Levin 30,188 on at
    RE: How to hide / show new button inside lookup

    Hi Brekaa,

    You can't hide in in any supported way except for privileges.

    You can look at some of the unsupported ways above.

    Hope this helps.

  • Suggested answer
    Abdul Wahab Profile Picture
    Abdul Wahab 12,070 Super User 2024 Season 1 on at

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

#2
Martin Dráb Profile Picture

Martin Dráb 230,198 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans