I am going to set input's value to a text element when button is clicked? How can i do that?

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: {
			onPageClick: function() {
				var GreetingValue = this.get("SalutationType").value;
				var GreetingDisplayValue = this.get("SalutationType").displayValue;
 
 
				console.log(GreetingDisplayValue);
			},
			getMyButtonEnabled: function(){
				return true;
			}
		},
		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
					}
 
				},
 
            },
			{
				"operation": "insert",	
				"parentName": "ContactGeneralInfoBlock",
				"propertyName": "items",
				"name": "NewInput",
				"values": {
					itemType: Terrasoft.utils.inputBox,
                    caption: {bindTo: "Resources.Strings.NewButtonCaption"},
					click: {bindTo: "onPageClick"},
					enabled: {bindTo: "getMyButtonEnabled"},
					"style": Terrasoft.controls.ButtonEnums.style.BLUE,
					"layout": {
						"column": 6,
						"row": 3,
						"colSpan": 8,
						"rowSpan": 1
					}
 
				},
			}
		]/**SCHEMA_DIFF*/
	};
});

 

Like 0

Like

3 comments
Best reply

You can do it by using this.set("StringColumn", valueNeeded); in the click-handler function for your button.

 

Best regards,

Oscar

You can do it by using this.set("StringColumn", valueNeeded); in the click-handler function for your button.

 

Best regards,

Oscar

Oscar Dylan,

thanks i will try it

 

Oscar Dylan,

how can i get innertext or innerhtml of something?

 

Show all comments

Hello

 

I am trying to update a lookup field linked to Employee section for multiple records using an input box. But, the list of records are not displaying either by typing in the field or clicking on magnifying glass icon. 

I have tried using every property for binding this to the object. But none of them works. I have attached the code snippet of this custom action for reference.

 

So please suggest a way to bind it to the correct schema and display its correct records.

 

Regards,

Malay

File attachments
Like 0

Like

4 comments

Hi Malay, 

 

Lookups are usually looking like that.

 

You can add "isSimpleLookup" to the virtual lookup attribute to make it a drop-down ,  so it might be much convenient for you.

 

Example:

 

"YourLookup": {
    dataValueType: Terrasoft.DataValueType.LOOKUP,
    isSimpleLookup: true,
    referenceSchemaName: "Employee"
}

 

Best Regards, 

 

Bogdan L

Hi Bogdan Lesyk,

 

Thank you for your response.

 

I was asking about the binding of object with this virtual lookup. As, this is not properly bind with any object, it is not showing any values.

I have also inserted the property referenceSchemaName: "Employee" but it still does not show any values.

 

Regards,

Malay

Malay,

 

If you don't see any values of your Lookup, you've probably added wrong name of the object your Lookup should referring to.

 

Please check out the example of how it should looks like:

 

https://community.creatio.com/articles/virtualcolumn-lookup-field

 

Also check out the code my test implementation:

 

 attributes: {

                "UsrTestLookup": {

                    "dataValueType": Terrasoft.DataValueType.LOOKUP,

                    "type": Terrasoft.ViewModelColumnType.VIRTUAL_COLUMN,

                    isLookup: true,

                    caption: "virtual street",

                    referenceSchemaName: "Employee",

          isSimpleLookup: true

                }

            },

 

diff: /**SCHEMA_DIFF*/[

      {

                    "operation": "insert",

                    "parentName": "ProfileContainer",

                    "propertyName": "items",

                    "name": "UsrTestLookup",

                    "values": {

                        bindTo: "UsrTestLookup",

                        "caption": {"bindTo": "Resources.Strings.UsrTestLookupCaption"},

                        layout: {column: 0, row: 8, colSpan: 12}

                    }

                },

 

As far as I choose

 "parentName": "ProfileContainer"

and

isSimpleLookup: true,

please check out the result of such implementation.

 

 

So on Contact page I've got my "some lookup test" which has it's values from "Employee" object which it refers to.

 

Also please note,  that Virtual Lookup columns most often exist to store intermediate values, that can be further used for data processing.

 

Best Regards, 

 

Bogdan L.

 

 

Hi Bogdan,



How to add filter to the virtual Lookups, I had followed the above method to add virtual lookup. And when I tried to add filter to that, its not filtering out the data.

I have attached my code for the reference,





After adding the filter I am able to see all the values in the Lookup.

Is there a way, to Filter the Lookup values in Virtual lookup column ?



Regards,

Adharsh S

Show all comments