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)

'No Name' Lookup Issue.

(0) ShareShare
ReportReport
Posted on by 407

Dear Expertise,

I Implement a code which set the value for Lookup field.

On Opportunity Entity I have a field Account as a look. As per business requirement, I have to add a Ribbon Button on Account Form which will create a new opportunity and set Account field on Opportunity. I tried to set the value on account field of opportunity but when it get set it say 'No Name'. 

Save and refresh the Opportunity will show the correct value on it but when redirect from Account to Opportunity it show 'No Name'

https://community.dynamics.com/crm/f/117/t/291889 - reference. i don't how to incorporate this code.

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    Rawish Kumar Profile Picture
    13,758 on at

    Hi Aniket,

    Please post the script you are using to set the lookup value.

  • AM-22040756-1 Profile Picture
    407 on at

    function OpenNewOpportyFromAcc() {

          debugger;

      var parameters = {};

            if (Xrm.Page.data.entity.getId() != null) {

              parameters["parentaccountid"] = Xrm.Page.data.entity.getId();          

          }  

          Xrm.Utility.openEntityForm("opportunity", null, parameters);

    }

    Xrm.Page.data.entity.getId() - this will give me record ID of Account.

    parentaccountid - is the attribute on Opportunity which is lookup

  • AM-22040756-1 Profile Picture
    407 on at

    OpenNewOpportyFromAcc() , Is called from Ribbon Button from Account

  • Verified answer
    Rawish Kumar Profile Picture
    13,758 on at

    Hi Aniket,

    in your parameter pass on more field :

    var parameters = {};

           if (Xrm.Page.data.entity.getId() != null) {

             parameters["parentaccountid"] = Xrm.Page.data.entity.getId();      

             parameters["parentaccountidname"] = "name of the record"

         }  

    to get the name of the record you can simply retrieve the name of the current record from name field "Xrm.Page.getAttribute(namefield)"

    hope this helps!

  • KaeL Profile Picture
    224 on at

    i already faced that problem before that on the lookup field it shows "No name" on the lookup field but when I click the lookup field (No name) it goes to the correct value. All you need to to is you need to pass the value on the name field on that entity. for example on the Owner field just set a an event on the "On change event" to auto pass the value on the name field.

    Hope this solution will help you

    -KaeL

  • KaeL Profile Picture
    224 on at

    getname: function() {

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

    var nameValue= Xrm.Page.getAttribute("owner");

    Xrm.Page.getAttribute("name").setValue(nameValue);

    }

    add this on code on the onChange event

  • Verified answer
    Mahadeo Matre Profile Picture
    17,021 on at

    Hi,

    When you setting value to lookup using JavaScript and not not adding lookup name, then "No name" will be shown.

    Once record is saved CRM will pull lookup name / text value and will be displayed in lookup field.

    you need to pass lookup name also

    parameters["accountidname"] = "Account name";

    hope this will help..

  • Suggested answer
    AM-22040756-1 Profile Picture
    407 on at

    Thanks

  • Sveco Profile Picture
    5 on at

    Same issue with on-premise version 9.0.8. Can we focus on getting Microsoft fix this issue (as it is clearly an issue easily solved) instead of having to use workaround. What would be correct place to report bug?

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