web
You’re offline. This is a read only version of the page.
close
Skip to main content
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);
});

I have the same question (0)
  • 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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Abhilash Warrier – Community Spotlight

We are honored to recognize Abhilash Warrier as our Community Spotlight honoree for…

Leaderboard > Customer experience | Sales, Customer Insights, CRM

#1
Rishabh Kanaskar Profile Picture

Rishabh Kanaskar 258

#2
MVP-Daniyal Khaleel Profile Picture

MVP-Daniyal Khaleel 179

#3
Tom_Gioielli Profile Picture

Tom_Gioielli 127 Super User 2025 Season 2

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans