web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Set value in lookup fi...
Power Apps
Unanswered

Set value in lookup field on quick create form with only an ID

(0) ShareShare
ReportReport
Posted on by 12

Hi,

 

In a model driven app i've created a custom button (ribbon workbench) on a subgrid. When you click on the button it will open a quick create form from the table 'invoice'. On that quick create form I want to fill a lookup field (dossier) with the ID of the record from the page where the button is placed (dossier).

 

So far this works only the lookup field shows the linked record without the name (no name or undefined). When the record (invoice) is saved and you navigate to the record, the correct lookup record (dossier) is linked and you will also see that the name is displayed correctly. I retrieve the record (dossier) by an onload javascript. Var str_id is passed when the quick create form is opened

 

StefanBreedveld_0-1623664662539.png

 

 

function CreateInvoiceFromDossier()
{
var ActiveSelectedRows = Xrm.Page.getControl("Subgrid_Declaraties").getGrid().getSelectedRows().getLength();
var selectedIdArray = "";
var selectedRows = Xrm.Page.getControl("Subgrid_Declaraties").getGrid().getSelectedRows();

// Get Dossier ID -> record GUID on page
var id = Xrm.Page.data.entity.getId();
var str_id = id.replace(/[{}]/gi, '')

 

// Get GUID of selected rows (expenses) in subgrid

selectedRows.forEach(function(selectedRow, i) {
selectedRecordId = selectedRow.getData().getEntity().getId().replace('{', "").replace('}', "");
selectedIdArray = selectedIdArray + selectedRecordId.trim() + ",";
});

 

// Open invoice quick create form. Set GUID (expenses, selected rows) in textarea field, add ID of page to lookup field

var RecordID = { asp_expenses_guid: selectedIdArray.slice(0, -1), asp_dossier_invoice: str_id };
Xrm.Utility.openQuickCreate("asp_invoice", null, RecordID).then(function () { console.log("Success"); }, function (error) { console.error(error.message); });

 

Can someone help me to set the name of the linked lookup record (dossier)?

 

Thanks!

Categories:
I have the same question (0)

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 356 Most Valuable Professional

#2
11manish Profile Picture

11manish 225 Super User 2026 Season 2

#3
Mohsin Ali Profile Picture

Mohsin Ali 211

Last 30 days Overall leaderboard