reset page lookup field to null ("not filled in" state)

I need to reset a page field to the state "not filled in", based on the value of some other fields values, in order to force the user to re-enter it.

Is it possible ?

Like 0

Like

3 comments
Best reply

Norton Lingard,

I have just written an tested the solution..

thanks for your attention.

...

attributes: {  

                 "NullLookup": {

                        "dataValueType": this.Terrasoft.DataValueType.LOOKUP,

                        "type": this.Terrasoft.ViewModelColumnType.VIRTUAL_COLUMN,

                    "value": null

                    }

                    "FinMainCategory": {

                        dataValueType: Terrasoft.DataValueType.LOOKUP,

                        dependencies: [

                            {

                                columns: ["FinEntryType"],

                                methodName: "setMainCategoryToNull"

                            }

                        ]

                    },

...

methods: {

...

            // Handler method that sets Main Category to null

            setMainCategoryToNull: function() {

                var nullLookup = this.get("NullLookup");

                this.set("FinMainCategory", nullLookup);

            },

...

Dear Ricardo,

 

In order to implement the required functionality please use the “dependencies” property of an attribute and in a method-handler set the value of the field to the “not filled in” value. Please see the example of the code below (UsrTest, Dear and Phone are the attributes of a particular object):

 

attributes: {

       "UsrTest": {

            "dependencies": [

              {

                "columns": ["Dear", "Phone"],

                "methodName": "setUsrTest"

               }

            ]

          }

      }

 

setUsrTest: function(){

                if (this.get("Phone") === "111" && this.get("Dear") === "test"){

                    this.set("UsrTest", "not filled in"); 

                }

            }

 

 

Please find additional information in the article by the link below:

 

https://academy.creatio.com/documents/technic-sdk/7-16/attributes-attributes-property

 

Best regards,

Norton

Norton Lingard,

It is a lookup field. 

The goal is to force the user to clear the field value, in order to force the user to enter a new value, just like a field that has nor been filled in yet.

 

Norton Lingard,

I have just written an tested the solution..

thanks for your attention.

...

attributes: {  

                 "NullLookup": {

                        "dataValueType": this.Terrasoft.DataValueType.LOOKUP,

                        "type": this.Terrasoft.ViewModelColumnType.VIRTUAL_COLUMN,

                    "value": null

                    }

                    "FinMainCategory": {

                        dataValueType: Terrasoft.DataValueType.LOOKUP,

                        dependencies: [

                            {

                                columns: ["FinEntryType"],

                                methodName: "setMainCategoryToNull"

                            }

                        ]

                    },

...

methods: {

...

            // Handler method that sets Main Category to null

            setMainCategoryToNull: function() {

                var nullLookup = this.get("NullLookup");

                this.set("FinMainCategory", nullLookup);

            },

...

Show all comments