Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Customer experience | Sales, Customer Insights,...
Answered

How to write code to save the default lookup column in dynamics 365 form

(0) ShareShare
ReportReport
Posted on by 102

Im trying the same code as mentioned my microsoft documnet openForm (Client API reference) in model-driven apps - Power Apps | Microsoft Learn

But  i have a lookup column which is not a person type column then how can i give the default value?

formParameters["currencylookup"] = "Sample";

above is the lookup column i want to give default value , used the above code it doesnt work, the below code works only for text column and person type lookup column

var entityFormOptions = {};
entityFormOptions["entityName"] = "email";

// Set default values for the Contact form
var formParameters = {};
formParameters["subject"] = "Sample";
formParameters["description"] = "Default values for this record were set programmatically.";

// Set lookup column
formParameters["regardingobjectid"] = "3493e403-fc0c-eb11-a813-002248e258e0"; // ID of the user.
formParameters["regardingobjectidname"] = "Admin user"; // Name of the user.
formParameters["regardingobjectidtype"] = "systemuser"; // Table name.
// End of set lookup column

// Open the form.
Xrm.Navigation.openForm(entityFormOptions, formParameters).then(
function (success) {
console.log(success);
},
function (error) {
console.log(error);
});

  • Verified answer
    a33ik Profile Picture
    84,331 Most Valuable Professional on at
    RE: How to write code to save the default lookup column in dynamics 365 form

    Hello,

    If the mentioned field is a lookup to currency you should use something like the following:

    formParameters["currencylookup"] = "Guid of the currency here";

    formParameters["currencylookupname"] = "US Dollars";//Place the currency name here

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

Ramesh Kumar – Community Spotlight

We are honored to recognize Ramesh Kumar as our July 2025 Community…

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

Leaderboard > Customer experience | Sales, Customer Insights, CRM

#1
Holly Huffman Profile Picture

Holly Huffman 103

#2
Muhammad Shahzad Shafique Profile Picture

Muhammad Shahzad Sh... 96 Most Valuable Professional

#3
Gerardo Rentería García Profile Picture

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

Product updates

Dynamics 365 release plans