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)

open by default account entity from lookup new button

(0) ShareShare
ReportReport
Posted on by

hi,


In my form there is a lookup for Specifier account.

but when i click on +new button, it opens new contact form instead of account form

any idea ?

*This post is locked for comments

I have the same question (0)
  • Bruno Lucas Profile Picture
    5,421 on at

    how is that field set in the form?. it the field like this?

  • Community Member Profile Picture
    on at

    hi,

    there is type customer instead of Lookup and its disabled.


  • Suggested answer
    Nizar JLASSI Profile Picture
    2 on at

    Hi Chirag,

    The Customer type is a specific type that you can see it as a double relationship with account and contact. And when you put a customer lookup on a form it allow you to choose an account or a contact as a customer.

    But when you click on + button, CRM cannot view 2 new forms one for account and the other for contact, that's why it display only account new form.

    I don't know if you can modify the + button behavior on the customer lookup.

    But I have a solution : if you want that everytime you choose a customer it should be a contact, you can add a new N:1 relationship with contact and you remove the customer lookup and replace it by the new contact lookup.

  • Aileen Gusni Profile Picture
    44,524 on at

    Hi Chirag,

    May I know first, you are in which entity form? Opportunity, Case, or what entity?

    Thanks.

  • Bruno Lucas Profile Picture
    5,421 on at

    Well, like Nizar explained, this is a normal behavior with a Type=Customer. The solution depend of what you want to accomplish. the + New open the quick forms, i don't think you can change that with JavaScript or by changing any setting because of the relationship.

  • Community Member Profile Picture
    on at

    Hi,

    Its Project entity.

  • Suggested answer
    Nizar JLASSI Profile Picture
    2 on at

    There is a solution:

    In CRM 2011, when we use customer lookup and we want that get only accounts or contacts, we use a javascript code to force the entity object code type in the customer lookup.

    The CRM 2011 javascript code is the same code as in CRM 2013 but in CRM 2013 you should search "#customerid_i" instead of "#customerid".

    By using this code, you force only one type of entity in your customer lookup, may be the add button behavior change also.

    there is the javascript code :

    1.  
    2. // objectTypeCode : should be a string containing '2' for Contacts and '1' for Accounts
    3. // recentItemCodes : should be a string containing '2,1' for Contacts and '1,2' for Accounts
    4. function SetCustomerType(objectTypeCode, recentItemCodes) {
    5.     var cutomerButton = $('#customerid_i'); // You need to add jQuery js library before
    6.     cutomerButton.attr('defaulttype', objectTypeCode); //changes default advanced find entity type to objectTypeCode that you want
    7.     cutomerButton.attr('lookuptypes', recentItemCodes); //changes recent items to recentItemCodes
    8. }

     

  • Community Member Profile Picture
    on at

    Hi,

    I have already tried this , when i open lookup its working as what i have set the default and only 1 entity.

    But the +new button always open Contact entity instead of Account.

    My Code :

    document.getElementById("customerid_i").setAttribute("defaulttype", "1");

    document.getElementById("customerid_i").setAttribute("lookuptypes", "1");

  • Suggested answer
    Community Member Profile Picture
    on at

    If you want the + New button to pop the new account form, use the parentaccountid field on your form instead of the customerid field.

    As replies before me have pointed out... a "Customer" (customerid) typed lookup field in CRM is special - resolves both Accounts and Contacts.  But Microsoft has linked this field to 2 normal lookup fields on the same entity (opportunity, here): Parent Account (parentaccountid) and Parent Contact (parentcontactid).  In the background, any time you fill in the customerid field, either the parentaccountid or parentcontactid also receives a value according to the record type you chose in the customerid field.

    The link goes the other way too.  If you fill in the parentaccountid field, the customerid field will be filled in with that account.  If you fill in both the parentaccountid and parentcontactid fields, I think the customerid field uses the value from parentaccountid... or maybe uses the value from whichever of the two normal lookup fields was filled first.

    So if you put the parentaccountid field on your form, that should pop the Account create form whenever you click the + New button.

  • Community Member Profile Picture
    on at

    The way I solved this problem was to hide the customerid field (set invisible).  Then I created a new field with the same display name, and placed it exactly where the customeridfield was.  I added a script 

        var value = Xrm.Page.getAttribute("new_project_owner").getValue();
        Xrm.Page.getAttribute("customerid").setValue(value);

    and everytime I change the new field i set the hidden field.  this way whenever they hit the + NEW button it will bring up the quick create for account and when they save it it will be updated behind the sences.

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