Article

Trying to get values with the attribute and method properties.

Hello, 

 

I am trying to edit the schema for a page (Quotes) to grab the connected project's contact and account names with the attribute and method properties.

 

So far my code is grabbing the name, but it is not being set correctly. As well, the contact title for the page is disappearing when I add the attribute.KwlContact bit 

Hello, 

 

I am trying to edit the schema for a page (Quotes) to grab the connected project's contact and account names with the attribute and method properties.

 

So far my code is grabbing the name, but it is not being set correctly. As well, the contact title for the page is disappearing when I add the attribute.KwlContact bit 

 

This is the result:

 

If I comment out the  attribute.KwlContact bit I get this:

 

What am I missing to get this code to work?

Share

1 comments

Dear Philip,

First. An attribute doesn't know what is "onChanged" property. To launch a method when an attribute is changed use "dependencies" property:

 attributes: {
            "KwlContactName": {
                "dataValueType": this.Terrasoft.DataValueType.TEXT,
                "type": this.Terrasoft.ViewModelColumnType.ENTITY_COLUMN,
                "columnPath": "KwlProject.Contact.Name",
                "caption": {bindTo: "Resources.Strings.KwlContactCaption"},
                "dependencies": [
                    {
                        "columns": [ "KwlProject" ], // columns that trigger a call
                        "methodName": "onSomePropertyChanged"
                    }
                ]
            }
        },

Second. You cannot write project["Contact.Name"] because project variable doesn't have anything but value and display value fields. You should use client EntitySchemaQuery to read new contact name and set it to KwlContactName in async way.

Third. It seems you have an issue with localizable string. Maybe it doesn't exist or you didn't specified a value for language of user's profile.

Log in or register to comment