Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics CRM (Archived)

Hide New Button Inside LookUp

Posted on by 40

this is my code to show/ hide new button inside lookup

using crm 2013

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

  • Shahbaaz Ansari Profile Picture
    Shahbaaz Ansari 6,203 on at
    RE: Hide New Button Inside LookUp

    i think you already solved this, in your last post

    community.dynamics.com/.../281002

  • Brekaa Profile Picture
    Brekaa 40 on at
    RE: Hide New Button Inside LookUp

    Koen VdV

    Thanks,,

  • Brekaa Profile Picture
    Brekaa 40 on at
    RE: Hide New Button Inside LookUp

    Hi Goutam Das

    new button hide/ show  dependence on option set control  

    for one user

  • Suggested answer
    Koen VdV Profile Picture
    Koen VdV 1,217 on at
    RE: Hide New Button Inside LookUp

    Hi Brekaa,

    I don't want to point out the obvious here, but code like this is usually non-supported. Consequently, I'm not going to review it (Remark: I'm not a technical guy, so I'm not even able to it :) )

    Moreover, you could use security privileges to prevent people from making a new record.

  • Suggested answer
    gdas Profile Picture
    gdas 50,085 on at
    RE: Hide New Button Inside LookUp

    Looks like this is not suppopted code. You can only hide lookup control new button  by removing create privileges from user security roles.

  • Brekaa Profile Picture
    Brekaa 40 on at
    RE: Hide New Button Inside LookUp

    Hi Koen

    my question

    how to hide / show new button inside lookup

    i wrote this code

    but not working

    can you review my code

  • Koen VdV Profile Picture
    Koen VdV 1,217 on at
    RE: Hide New Button Inside LookUp

    Hi Brekaa,

    I'm not sure what your goal is with this post? Do you have a question?

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