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 :
Microsoft Dynamics CRM (Archived)

How to hide / show new button inside lookup

(0) ShareShare
ReportReport
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

I have the same question (0)
  • Suggested answer
    Abdul Wahab Profile Picture
    12,119 Moderator on at
  • Aric Levin - MVP Profile Picture
    30,190 Moderator on at

    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.

  • Brekaa Profile Picture
    40 on at

    Hi Abdul Wahab

    i saw this sites before

    and i can't any solved .

  • Brekaa Profile Picture
    40 on at

    Hi Aric Levin

    I use javascript to solve it but not working

  • Suggested answer
    Shahbaaz Ansari Profile Picture
    6,211 on at

    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
    40 on at

    Hi Shahbaaz Ansari

    Not working

  • gdas Profile Picture
    50,091 Moderator on at

    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 ?

  • Verified answer
    Brekaa Profile Picture
    40 on at

    Hi Goutam Das

    I solved it by javaScrpit

    this is Solve

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

    Thanks,,

  • Suggested answer
    Shidin Haridas Profile Picture
    3,497 on at

    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.

  • Brekaa Profile Picture
    40 on at

    Hi Shidin Haridas

    sure , but now its work

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
SA-08121319-0 Profile Picture

SA-08121319-0 4

#1
Calum MacFarlane Profile Picture

Calum MacFarlane 4

#3
Alex Fun Wei Jie Profile Picture

Alex Fun Wei Jie 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans