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 :
Customer experience | Sales, Customer Insights,...
Unanswered

Set Organization lookup to default with account record in portal page

(0) ShareShare
ReportReport
Posted on by 467

Hi all,

I am using following Jquery code to set default value to Organization lookup field in portal page(powerapps portals).

I am trying to set account record as my default value.

But not working.

Can someone tell me what went wrong.

Bit urgent

$("customer_name").attr("value","XXXXXXXXX");
$("customer").attr("value","42e9af18-c077-ea11-a811-000d3acb08cf");
$("#customer_entityname").attr("value","account");

Regards,

Babu

I have the same question (0)
  • cloflyMao Profile Picture
    25,210 on at

    Hi Babu,

    1. Can your see the record in popup dialog?

    pastedimage1586833523536v1.png

    2. Would name of field actually be customerid instead of customer?

    ,and '#' is also required for selector of first and second lines.

    Please check id of input fields again for confirmation:

    pastedimage1586833781288v2.png

    Regards,

    Clofly

  • Narendra Sunkara Profile Picture
    467 on at

    Hi Clofly,

    Following code worked for me. I gave wrong id in first line

    $("#customerid_name").attr("value","XXXXXXXXX");

           $("#customerid").attr("value","42e9af18-c077-ea11-a811-000d3acb08cf");

           $("#customer_entityname").attr("value","account");

    I could able to populate lookup field value now in dev. Do I need to do same thing in other environments(SIT, Prod) also?

    Regards,

    Babu

  • cloflyMao Profile Picture
    25,210 on at

    Hi Babu,

    It depends on whether id values of three selectors in other environments can also match to corresponding id attribute of input elements.

    Please open inspector with F12 to confirm them.

    Regards,

    Clofly

  • Narendra Sunkara Profile Picture
    467 on at

    Hi Clofly,

    Now I am getting other problem.

    I could not able to submit the form after I prepopulate the lookup.

    I am getting following error. Don't know the reason.

    An unknown failure has occurred. Error ID # [063e11a6-eb0d-4826-b40a-2ab4b43be438]

    Previously it was submitting correctly when select lookup value from popup.

    Your help appreciated

    Regards,

    Babu

  • cloflyMao Profile Picture
    25,210 on at

    Hi Babu,

    It's a generic error.

    Can you create record in CRM directly with same lookup customer or by selecting a same customer from popup without prepopulating?

    Try to troubleshoot by answer in this thread:

    https://community.dynamics.com/crm/f/microsoft-dynamics-crm-forum/278969/error-while-submitting-data-from-portal/796511

    Regards,

    Clofly

  • cloflyMao Profile Picture
    25,210 on at

    In addition, here is another thread which the final answer would be similar to your issue:

    https://community.dynamics.com/crm/f/microsoft-dynamics-crm-forum/243513/issue-in-customer-self-service-portal-in-dynamic-365/672709

    If the field couldn't be set to get populated by javascript to submit form, then create an Entity Form Metadata record for your entity form to solve the issue.

    pastedimage1586844264386v1.png

    pastedimage1586844312035v2.png

    Regards,

    Clofly

  • Inogic Profile Picture
    703 on at

    You can use below code to set default value in lookup field;

     set-default.png

    Also, you can pre-populate lookup field using Entity Form Metadata, below given is a reference link:

     

    docs.microsoft.com/.../configure-web-form-metadata

     

    Thanks!

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 > Customer experience | Sales, Customer Insights, CRM

#1
Tom_Gioielli Profile Picture

Tom_Gioielli 108 Super User 2025 Season 2

#2
Jimmy Passeti Profile Picture

Jimmy Passeti 50 Most Valuable Professional

#3
Gerardo Rentería García Profile Picture

Gerardo Rentería Ga... 49 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans