UNPKG

xrmscriptworkbench

Version:

The base types to create custom script for Dynamics 365 within a XrmScriptWorkbench project.

77 lines (76 loc) 2.35 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var FormProxy = /** @class */ (function () { function FormProxy() { } /** * Asynchronously saves the record. * @returns Returns an asynchronous promise. */ FormProxy.prototype.save = function () { var _this = this; return new Promise(function (resolve, reject) { _this.Xrm.Page.data.save() .then(resolve) .fail(reject); }); }; /** * Asynchronously refreshes data on the form, without reloading the page. * @param save true to save the record, after the refresh. * @returns Returns an asynchronous promise. */ FormProxy.prototype.refresh = function (save) { var _this = this; return new Promise(function (resolve, reject) { _this.Xrm.Page.data.refresh(save) .then(resolve) .fail(reject); }); }; Object.defineProperty(FormProxy.prototype, "FormType", { /** * Gets form type. * @returns The form type. * @remarks **Values returned are**: * * 0 Undefined * * 1 Create * * 2 Update * * 3 Read Only * * 4 Disabled * * 6 Bulk Edit * * Deprecated values are 5 (Quick Create), and 11 (Read Optimized) */ get: function () { return Xrm.Page.ui.getFormType(); }, enumerable: true, configurable: true }); Object.defineProperty(FormProxy.prototype, "FormName", { /** * Gets the label for the form. * @returns The FormName. */ get: function () { return { name: Xrm.Page.ui.formSelector.getCurrentItem().getLabel() }; }, enumerable: true, configurable: true }); Object.defineProperty(FormProxy.prototype, "Xrm", { /** * @returns The current Xrm Object on this script */ get: function () { return this._xrm; }, set: function (xrm) { this._xrm = xrm; }, enumerable: true, configurable: true }); return FormProxy; }()); exports.FormProxy = FormProxy;