Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Dynamics 365 general forum

Quick Create save throwing unexpected error before callback - UCI Only

(0) ShareShare
ReportReport
Posted on by

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):

pastedimage1568866823169v1.png

{"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);
}

  • Community Member Profile Picture
    on at
    RE: Quick Create save throwing unexpected error before callback - UCI Only

    We are not sending oData, that is happening behind the scenes by Microsoft as a batch request. All we do is pre-populate the quick form, which is working fine. Once we hit save, it blows up before it even hits our custom code in the callback. Microsoft is sending this batch request behind the scenes, we are unable to control it. It looks like in the old web interface they were using a SOAP request and have now switched to a batched API call.

    Old web interface:

    pastedimage1568905205158v1.png

    New web interface:

    pastedimage1568905368744v2.png

    pastedimage1568905392519v3.png

  • Suggested answer
    Kalpavruksh D365 CoE Profile Picture
    2,545 on at
    RE: Quick Create save throwing unexpected error before callback - UCI Only
    Hi,
    oData is not supported in UCI hence please refer to the following link to replace it with webAPI.

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

November Spotlight Star - Khushbu Rajvi

Congratulations to a top community star!

Forum Structure Changes Coming on 11/8!

In our never-ending quest to help the Dynamics 365 Community members get answers faster …

Dynamics 365 Community Platform update – Oct 28

Welcome to the next edition of the Community Platform Update. This is a status …

Leaderboard > Dynamics 365 general forum

Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans