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*/
	};
});

 

Like 0

Like

4 comments
Best reply

Hello,

 

Eugene in this community post shared an example on how to modify the lookup value from the client-side logic. Use the:

 

this.set("LookupName", {value:"id", displayValue:"text"});

 

Best regards,

Oscar

Hello,

 

Eugene in this community post shared an example on how to modify the lookup value from the client-side logic. Use the:

 

this.set("LookupName", {value:"id", displayValue:"text"});

 

Best regards,

Oscar

it is showing undefined when i clicked the button.

Oscar Dylan,

can you help me like that?

 

Muhammadjon Yakhyoev,

 

It means that you specify something that shouldn't be set in this column. Only records present in the AccountType lookup can be set as a value in this column. Additionally you need to debug the code and see what exactly is being set in this column and check if there is no additional logic that set the value for a field there.

 

Best regards,

Oscar

Show all comments