ADXStudio – Set values in Lookup fields of Entity Forms

This is one of the common requirement in ADXStudio to set values in Lookup Fields in Entity Forms. Initially it was very difficult for me to get the solution of this but finally i got the way. Here is the solution :

Suppose we are exposing Case Entity Form on ADXStudio Portal and we have a Customer Lookup on that form and i want to set value in this lookup field-

Step 1 : Get Lookup IDs
Right Click on Lookup Field and Click Inspect to see rendered HTML or press F12. You will find three IDs of that lookup field:
Name ID ; customer_name
Guid ID : customerid
EntityName ID : customer_entityname
Same for other lookup you will find same IDs but with different names.
So same as CRM Lookups, ADXStudio also keep three values for each lookup rendered on portal forms.






Step 2: Set values in Lookup Fields
Write below JavaScript in Custom JavaScript Section of Entity Forms
$(document).ready(function(){
    $(\”#customer_name\”).attr(\”value\”,\”A J E CALDER LTD\”);
    $(\”#customerid\”).attr(\”value\”,\”0a4d0c86-4253-e611-80f0-5065f38b75b1\”);
    $(\”#customer_entityname\”).attr(\”value\”,\”contact\”);
});
In first line i have set the name of record, in second line i have set the guid and in third line i have set the name of entity to which this record belongs.
So this way we can set value in any of the lookup field in ADXStudio Entity Forms.

Published by arpitpowerguide

My name is Arpit Shrivastava, who is a Microsoft MVP in the Business Applications category. I am a Microsoft Dynamics 365 and Power Platform enthusiast person who is having a passion for researching and learning new things and acquiring immense knowledge. I am providing consistent help, support, and sharing my knowledge through various Social Media Channels along with my Personal Blog, Microsoft Community, conducting online training and attending various 365 Saturday Events worldwide and sharing the best Solutions to the readers helping them achieve their goals and objectives in Customer Relationship Space.

5 thoughts on “ADXStudio – Set values in Lookup fields of Entity Forms

  1. I'm using web forms, I have tried the script and it is working fine default value is getting populated in the lookup filed but when i click on the next step the value is not getting save to the lookup filed its throwing an error that the lookup field should have a value and save your changes. please suggest

    Like

  2. Step 2 reads: $(document).ready(function(){ $(\”#customer_name\”).attr(\”value\”,\”A J E CALDER LTD\”); $(\”#customerid\”).attr(\”value\”,\”0a4d0c86-4253-e611-80f0-5065f38b75b1\”); $(\”#customer_entityname\”).attr(\”value\”,\”contact\”);});Just check again, the field references are not 100% correct. It should read $(document).ready(function(){ $(\”#customerid_name\”).attr(\”value\”,\”A J E CALDER LTD\”); $(\”#customerid\”).attr(\”value\”,\”0a4d0c86-4253-e611-80f0-5065f38b75b1\”); $(\”#customerid_entityname\”).attr(\”value\”,\”contact\”);});Missing \”id\” on the second and fourth line. But very helpful, thanks!

    Like

  3. Special thanks to (hackingsetting50@gmail.com) for exposing my cheating husband. Right with me i got a lot of evidences and proofs that shows that my husband is a fuck boy and as well a cheater ranging from his text messages, call logs, whats-app messages, deleted messages and many more, All thanks to (hackingsetting50@gmail.com), if not for him i will never know what has been going on for a long time. Contact him now and thank me later.

    Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: