xrmscriptworkbench
Version:
The base types to create custom script for Dynamics 365 within a XrmScriptWorkbench project.
62 lines (61 loc) • 2.48 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
var AttributeProxy = /** @class */ (function () {
function AttributeProxy(_xrm, _attributeName) {
this._xrm = _xrm;
this._attributeName = _attributeName;
}
Object.defineProperty(AttributeProxy.prototype, "LogicalName", {
get: function () {
return this._attributeName.name;
},
enumerable: true,
configurable: true
});
Object.defineProperty(AttributeProxy.prototype, "Attribute", {
get: function () {
var attribute = this._xrm.Page.getAttribute(this._attributeName.name);
if (attribute === undefined) {
console.log("GetAttribute: No attribute with name '" + this._attributeName.name + "' available on current form!");
}
return attribute;
},
enumerable: true,
configurable: true
});
Object.defineProperty(AttributeProxy.prototype, "Control", {
get: function () {
var control = this._xrm.Page.getControl(this._attributeName.name);
if (control === undefined) {
console.log("GetControl: No attribute control with name '" + this._attributeName.name + "' available on current form!");
}
return control;
},
enumerable: true,
configurable: true
});
Object.defineProperty(AttributeProxy.prototype, "Value", {
get: function () {
var value;
if (this._xrm.Page.getAttribute(this._attributeName.name) !== undefined) {
value = this._xrm.Page.getAttribute(this._attributeName.name).getValue();
}
else {
console.log("Get: No attribute with name '" + this._attributeName.name + "' available on current form!");
}
return value;
},
set: function (value) {
if (this._xrm.Page.getAttribute(this._attributeName.name) !== undefined) {
this._xrm.Page.getAttribute(this._attributeName.name).setValue(value);
}
else {
console.log("Set: No attribute with name '" + this._attributeName.name + "' available on current form!");
}
},
enumerable: true,
configurable: true
});
return AttributeProxy;
}());
exports.AttributeProxy = AttributeProxy;