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);
});
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
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 290,524 Super User 2024 Season 2
Martin Dráb 228,469 Most Valuable Professional
nmaenpaa 101,148