Hello community!
I am going to change user type when button clicked, plaese help me ASAP!
define("ContactPageV2", [], function() {
return {
entitySchemaName: "Contact",
attributes: {},
modules: /**SCHEMA_MODULES*/{}/**SCHEMA_MODULES*/,
details: /**SCHEMA_DETAILS*/{}/**SCHEMA_DETAILS*/,
businessRules: /**SCHEMA_BUSINESS_RULES*/{}/**SCHEMA_BUSINESS_RULES*/,
methods: {
// owner is NULL = disable button
onPageClick: function() {
var textInput = this.get("Owner");
var textType = this.get("Type");
console.log(textType);
console.log(textInput.value);
if (textInput) {
this.set("Type", {value: "60733efc-f36b-1410-a883-16d83cab0980", displaValue: "Employee", markerValue: "Employee", customHtml: "Employee", primaryImageVisible: false });
}
var ageInput = this.get("Age");
this.set(ageInput, 24);
console.log(ageInput);
},
getMyButtonEnabled: function(){
var textInput = this.get("Owner");
var result = !!textInput;
return result;
}
},
dataModels: /**SCHEMA_DATA_MODELS*/{}/**SCHEMA_DATA_MODELS*/,
diff: /**SCHEMA_DIFF*/[
{
"operation": "insert",
"parentName": "ContactGeneralInfoBlock",
"propertyName": "items",
"name": "NewButton",
"values": {
itemType: Terrasoft.ViewItemType.BUTTON,
caption: {bindTo: "Resources.Strings.NewButtonCaption"},
click: {bindTo: "onPageClick"},
enabled: {bindTo: "getMyButtonEnabled"},
"style": Terrasoft.controls.ButtonEnums.style.BLUE,
"layout": {
"column": 12,
"row": 2,
"colSpan": 8,
"rowSpan": 1
}
},
},
]/**SCHEMA_DIFF*/
};
});