Skip to main content

Notifications

Microsoft Dynamics CRM (Archived)

Mandatory error Message for Lookup field in CRM 2013

Posted on by 990

Hello All,

I have one lookup field on CRM form which is mandatory, I am setting the value for it using javascript even after that it shows mandatory error message. I tried setting the focus on the field but no luck. Please find below screenshot.

Mandatory-Sign.png

*This post is locked for comments

  • Suggested answer
    Sabih Khan Profile Picture
    Sabih Khan 140 on at
    RE: Mandatory error Message for Lookup field in CRM 2013

    I had the same issue. I have done the following to fix it.

                       Xrm.Page.getControl("seda_lead").setNotification("CR Number Does not Exist, Create New Lead", "101")

                       Xrm.Page.getControl("seda_lead").clearNotification("101");

    Add the Notification and then remove it the error goes.

  • Rahul-Waghmare Profile Picture
    Rahul-Waghmare 990 on at
    RE: Mandatory error Message for Lookup field in CRM 2013

    No in that case its working fine only when I select the record with no name.

  • Pranesh M Juwale Profile Picture
    Pranesh M Juwale 1,196 on at
    RE: Mandatory error Message for Lookup field in CRM 2013

    Hi,

    Are you facing the same issue in case when the lookup is set with record having primaryfield value instead "."  ?

  • Suggested answer
    Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Mandatory error Message for Lookup field in CRM 2013

    walkthrough the link....hope it helps:  garethtuckercrm.com/.../crm-2013-new-features-javascript-notifications

  • Rahul-Waghmare Profile Picture
    Rahul-Waghmare 990 on at
    RE: Mandatory error Message for Lookup field in CRM 2013

    But, its a required field on form. I can not remove the required level.

  • Suggested answer
    Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Mandatory error Message for Lookup field in CRM 2013

    please try to add it in your code

    Xrm.Page.getAttribute("customerid").setRequiredLevel("none");

  • Rahul-Waghmare Profile Picture
    Rahul-Waghmare 990 on at
    RE: Mandatory error Message for Lookup field in CRM 2013

    1. Default Contact Entity.

    2. Yes its lookup field from Contact Entity.

    3. In Contact entity Full Name is primary key, but there are some records wherein value for Full Name is not present for those records, while selecting in lookup we are assigning default name to it as '.' after selecting its not clearing error message.

  • Suggested answer
    Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Mandatory error Message for Lookup field in CRM 2013

    can you elobrate more

    1. are you using custom entity or default.

    2. is customer id is a lookup field .

    3. from were you are fetching the customid id, is it correct that you fetch from same field and set it to same

  • Rahul-Waghmare Profile Picture
    Rahul-Waghmare 990 on at
    RE: Mandatory error Message for Lookup field in CRM 2013

    No luck. :(

  • Suggested answer
    Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Mandatory error Message for Lookup field in CRM 2013

    hi'

    can you try with this code below

    function onChange_Customer()

    {

    if(Xrm.Page.getAttribute("customerid").getValue() != null)

    {

    if(Xrm.Page.getAttribute("customerid").getValue()[0].name == '')

    {

    var id = Xrm.Page.getAttribute("customerid").getValue()[0].id;

    var firstEntityType = "contact";

    var lookup = new Array();

    lookup[0] = new Object();

    lookup[0].id = id;

    lookup[0].name = '.';

    lookup[0].entityType = firstEntityType;

    Xrm.Page.getAttribute("customerid").setValue(lookup);

           Xrm.Page.getControl("customerid").clearNotification();

    }

    }

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!

Community AMA December 12th

Join us as we continue to demystify the Dynamics 365 Contact Center

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,240 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,149 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans