Quick Create, open created record
The idea is , when you create a record with quick create, to redirect directly on created record. sometime you have a yellow button on the top right but in my case the yeallow button with the link to the new created record did not appear.
then I decide to redirect with JS
then yes we have function in a function
function MyBaseFunction()
Xrm.Utility.openQuickCreate("incident", recordId, parameters).then
function (lookup)
{
successCallback(lookup);
},
function (error)
{
errorCallback(error);
}
);
function successCallback(lookup) {
setTimeout(function () { Xrm.Page.data.entity.refresh(); }, 1000);
Xrm.Utility.openEntityForm("incident", lookup.savedEntityReference.id, null, null);
setTimeout(function () { Xrm.Page.data.entity.refresh(); }, 1000);
}
// **** Function called on error.
function errorCallback(e) { // *** No new contact created, which is an error we can ignore!
alert("Error: " + e.errorCode + " " + e.message);
}
}
then I decide to redirect with JS
then yes we have function in a function
function MyBaseFunction()
Xrm.Utility.openQuickCreate("incident", recordId, parameters).then
function (lookup)
{
successCallback(lookup);
},
function (error)
{
errorCallback(error);
}
);
function successCallback(lookup) {
setTimeout(function () { Xrm.Page.data.entity.refresh(); }, 1000);
Xrm.Utility.openEntityForm("incident", lookup.savedEntityReference.id, null, null);
setTimeout(function () { Xrm.Page.data.entity.refresh(); }, 1000);
}
// **** Function called on error.
function errorCallback(e) { // *** No new contact created, which is an error we can ignore!
alert("Error: " + e.errorCode + " " + e.message);
}
}
Commentaires
Enregistrer un commentaire