Showing results for 
Search instead for 
Did you mean: 
Frequent Visitor

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



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





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 =;
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)?




Helpful resources

Power Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Top Kudoed Authors
Users online (5,122)