javascript - SuccessCallback firing immediately in Xrm.Page.data.save -
i writing javascript code change form of entity in dynamics crm based on value of field on each form.
to change form, user has change value of field. during onchange event, js comes in, triggers saving, has wait result , change form. (if save , change @ same time, there still window shown asking user confirm leaving unsaved changes)
now there should way that:
xrm.page.data.save(saveoptions).then(successcallback, errorcallback)
as described on msdn:
saves record asynchronously option set callback functions executed after save operation completed.
i using such:
var campaigntype = xrm.page.getattribute('typecode').getvalue(); if (xxx.forms.hasownproperty(campaigntype)) { xrm.page.data.save().then(function () { xxx.redirecttoform(xxx.forms[campaigntype]); }, null);
but form change still triggered during save.
what doing wrong?
i faced similar problem while trying update process bar.
xrm.page.data.save().then (function () { window.location.reload(true); }, function () { windows.alert("broken"); } );
i suggest try apply logic on vanilla crm, me breaking logic third party component called n52 rules, code interfering callback forcing refresh of page before save event. code seems correct.
Comments
Post a Comment