We use custom javascript to launch a quick create form and pre-populate values, one of them being a lookup. Once the Quick Create form is complete, the callback is supposed to navigate to the new record that was just created.
This code works fine in the old web interface.
We are upgrading our scripts to be UCI compliant, and this is a bug that I have run into and cannot find a way around. We receive the following error when clicking the 'Save' button on the Quick Create form. (NOTE: our success and error callback never get hit.)
Screenshot (Yellow highlight is the lookup that we are pre-populating, and seems to be the cause of the error):
{"error":{"code":"0x0","message":"Could not find a property named 'ms_jobidname' on type 'Microsoft.Dynamics.CRM.ms_deal'.","innererror":{"message":"Could not find a property named 'ms_jobidname' on type 'Microsoft.Dynamics.CRM.ms_deal'.","type":"Microsoft.OData.ODataException","stacktrace":"}
This error is coming from a batch request that looks like it is being made during the save, but before any callbacks are hit. In the network tab it comes through as a $batch and the problem request payload looks like this:
GET /api/data/v9.0/ms_deals(156dfb3e-91da-e911-a986-000d3a378f36)?$select=_ms_contacttravelerid_value,_ms_accountaffiliateid_value,_ms_contactaffiliateid_value,ms_dealtype,_ms_jobid_value,ms_startdate,ms_lengthofassignment,ms_enddate,ms_regularhours,ms_overtimehours,ms_orientationhours,_ms_jobid_value,ms_jobidname,ms_dealtype,statecode,ms_dealid,entityimage_url HTTP/1.1 Prefer: odata.include-annotations="*" Accept: application/json MSCRM.ReturnNotifications: true
As you can see, it's making a web API call and including the attribute 'ms_jobidname' which doesn't exist on ms_deal. I've even commented out the part of my code that is specifying ms_jobidname to pre-populate the quick create form, and the error stays the same.
Code is below:
const parameters: any = { formid: dealFormIds[type], ms_dealtype: 717660002, ms_enddate: endDateStr, ms_jobid: jobId.slice(1, -1), ms_jobidname: formContext.getAttribute("ms_name").getValue(), ms_lengthofassignment: formContext.getAttribute("ms_lengthofassignment").getValue(), ms_orientationhours: formContext.getAttribute("ms_orientationhours").getValue(), ms_overtimehours: otHours, ms_regularhours: guaranteedHours, ms_startdate: startDateStr, }; const entityFormOptions: any = { entityName: "ms_deal", useQuickCreateForm: true, }; Xrm.Navigation.openForm(entityFormOptions, parameters).then( (success: any) => { navigateToNewDeal(success.savedEntityReference[0].id.slice(1, -1)); }, (error: any) => { parent.Mscrm.GlobalQuickCreate.GlobalQuickCreateBehavior.closeAllGlobalQuickCreateForms(); showErrorDialog('An error occurred while trying to create the new deal.', error.message); }); } function navigateToNewDeal(dealGuid: string) { const entityFormOptions = { entityId: dealGuid, entityName: "ms_deal", }; Xrm.Navigation.openForm(entityFormOptions); }