Hello community:



I'm defining a rule inside the section code schema to remove spaces from a field value when the user tries completes the field "UsrTexto1". It is defined as follows:

methods: {
    cambioTexto1: function() {
        var vueltas = this.get("Vueltas");
        this.set("Vueltas",vueltas+1);
 
        var txt1 = this.get("UsrTexto1");
        if (txt1.includes(' ')) {
            var txt2 = txt1.replaceAll(' ','');
            this.set("UsrTexto1",txt2);
        }
    },
}

So when the field is modified it searches for spaces inside the text and removes them. This is an example of execution:

1) When the user types the text value

2) After the method is executed:

 

The problem is that the function is executed too many times. I've added a counter 'vueltas' to show how many times the function is called and here it is the result:

It doesn't make sense as I think that the method should be called exactly 2 times (1st when it removes the spaces, and 2nd when the system detects new changes on the field and now there are no spaces). The main problem is that the whole operation is slowed down because of the high number of calls.

 

How can I fix this?

 

Thanks in advance!

Like 0

Like

5 comments

Hello,

Can you please clarify how exactly the cambioTexto1 method is called?

Thank you!

The issue is that every change made to the text results in it firing the function again, plus, the changed value won't be read by the function on subsequent calls due to the timing is that the function firing and the value changing, which is why it's getting called so many times (and likely exceeding out the call stack max).

 

Instead if firing the value on the change, maybe fire it on the blur (when the user exits the control). To do this, remove the change attribute for the control and add this to the values block for the control in the diff:

"blur": {
    "bindTo": "cambioTexto1"
}

Or you could do it on save before using callParent.

 

Ryan

Oleg Drobina,

Hello Oleg,

In the section page there is a field called "Texto1" (with the code UsrTexto1). Inside the code schema of that section is the method that I provided earlier.

As you may see the method is called cambioTexto1, which is compose of cambio ("change" in Spanish) and Texto1 (the name of the field). It means that Creatio internally calls that function each time the value of that field is modified (with a built-in trigger I guess).

Therefore, the method is always called automatically, I don't call it manually.

Thanks for your interest!

Ryan Farley,

That makes sense,



I will try that tomorrow and check if it solves the problem



Thanks for you help!

Ryan Farley,

Hi again,

 

I've tried with the solution you provided but I haven't been able to fix the issue yet.

 

I also took a look at and older post where you submitted the same solution. I've tried to follow the implementation as you suggest. Here I share the current code:

{
	"operation": "insert",
	"name": "STRINGe5cdab8a-f59c-4c1c-aa90-c412e4c3e5ae",
	"values": {
		"layout": {
			"colSpan": 24,
			"rowSpan": 1,
			"column": 0,
			"row": 1,
			"layoutName": "ProfileContainer"
		},
		"bindTo": "UsrTexto1",
		"enabled": true,
		"blur": {
			"bindTo": "cambioTexto1"
		}
	},
	"parentName": "ProfileContainer",
	"propertyName": "items",
	"index": 1
},

Note: I have also removed the attributes part as you mentioned.

The problem is that when I try to modify a register or create a new one this happens:

The page displays blank content and, as you can see on the browser console at the right, there is an error related to an undefined value.

The messages you see before the error are traces I added to see the variable values:

console.log("Vueltas: " + this.get("Vueltas"));
- Vueltas: 0
 
console.log("Modificado: " + this.get("Modificado"));
- Modificado: false
 
console.log("Value read: " + this.get("UsrTexto1"));
- Value read: undefined

I have already read the documentation for the client schemas and I still have no clue how to solve it.

 

Regards.

Show all comments

Hello,

 

I am working on adding new fields in the cases section on mobile application to be visible for a portal user when submitting a case. I have added the fields in page setup via mobile application wizard as shown bellow:

but I still can't see those fields on mobile as a portal user:

 

Is there a way to accomplish this?

 

Thanks,

 

Like 0

Like

1 comments

Hello Mariam,

 

you can try to clear the cache and synchronize the Mobile app once again after you have created the Case page.

 

Also, you can refer to the articles on the Academy to find the solution:

 

https://academy.creatio.com/docs/7-18/developer/mobile_development/cust…

 

https://academy.creatio.com/docs/7-18/user/platform_basics/mobile_app/p…

 

if this won't help, we recommend you create a support case based on the problem so our Support team will be able to work on the issue.

 

Regards,

Gleb.

Show all comments

in a custom SectionGridRowViewModel I need to access oa lookup column:

     just like as in

var isPlanned = this.get("FinEntryStatus").displayValue;

     I need to access the "FinType" field, such as in

var isPlanned = this.get("FinEntryStatus").FinType;

I tried to use  "lookupListConfig", but had no success.

...

          attributes: {

                    "FinEntryStatus": {

                        lookupListConfig: {

                            columns: ["FinType"]

                        }

                    }

          },

...

Please help.

Regards,

Like 0

Like

3 comments

Hi Ricardo, 

 

You need to use ActiveRow in order to get the value from the registry page.

 

Please try to use this code :

 

this.getActiveRow().get("Lookup column name").displayValue - it will return the value 

 

Please check the example below: 

 

 

Best Regards, 

 

Bogdan L 

 

 

 

Bogdan Lesyk,

Thanks for your reply. 

Clarifying:

I have a lookup named "FinEntryStatuses", which has columns, "Name", "Description", "FinType", etc

At a given selected row, with

      this.getActiveRow().get("FinEntryStatus").displayValue;

I get "Scheduled" as a response (which is  the "Name" column displayValue)

What I need is to access the "FinType" row displayValue, not the "Name" row displayValue.

would it be 

     this.getActiveRow().get("FinEntryStatus").value.get("FinType").displayValue;

?

 

 

Hi Ricardo, 

 

I will show you how it looks like: 

 

Lets imagine you are using Contacts section and you have Lookup "Type" of your contact. Here you have some values of this Lookup like "Contact person", "Customer", "Employee", "Supplier". And you picked value "Employee" for your contact.

 

 

Then in order this Lookup to be visible with "activeRow" you should go to View page and add the Lookup "Type" to fields which will be displayed. 

 

After this changes you will see the your Lookup on the registry page with selected value (Type, "Employee") like on the example above.

 

 

So therefore you will be able to get the value of chosen Lookup(which is already added on the selected record).

 

If you debug this code in your browser you can see that value of needed Lookup is visible and you can take it for your further actions. Example below: 

 

 

Please make sure that you added this Lookup on the registry page and choose the value for it, because otherwise it won't be visible  and you will not be able to take this value(pic.2).

 

 

Best Regards, 

 

Bogdan L.

Show all comments

I have created 3 new sections using section wizard and changed name of the UsrName field in all of them because I wanted different names.

But now whenever I publish any new object or compile items, I get this error. Is there any way to sort it out.

I am using demo environment.

Thank you

Like 0

Like

6 comments

Creatio does not like it when the UsrName is changed. You will need to change it back. You can change the title, but you cannot change the Name. You can, however, not use it. If you create a new String, you can change the Displayed Value in the Advanced Settings for the object to the new String you made. This changes the blue links to the new string instead of the UsrName.

 

Reid Burger,

 

Thanks for clarification.

I also would like to know if I can change the Required - At application level to No for UsrName.

RAMNATH SHARMA,

 

It is fine to change properties like required at application level to no. If the field is being used as the display value (like the name field) then having it blank would mean nothing would show in a lookup (if its used as a lookup somewhere). 

 

BTW it's usually a good idea to not rename column or object names and only change the titles once they're created. 

 

Ryan

Ryan Farley,

I changed back the names to UsrName using section wizard (which I later realized shouldn't have changed them back). Then I compiled the current workspace from Advanced settings to see if still any error occurs. 

Here are some screenshots

Now The errors are because I changed back the name to UsrName, it says that the old Name - UsrClaimant don't exist.

I also opened the source code where these errors were pointing to - 

 

 

But I can not edit the source code in Cloud demo instance.

Is there any way to change the source code or any process to correct these source codes?

 

Ramnath

Hi Ramnath,



As Reid mentioned, we do not recommend to change the name after the section being created.



If such an issue appears you can simply generate source code for all objects that are mentioned in compilation errors and compile modified items. If all necessary items were not removed this should fix the issue



Thank you.

Bohdan Zdor,

Thanks. I will definitely try this out.

Show all comments

Section Wizard is a dynamic way to build a system in Creatio to match your needs. Join us during this online user group discussion to learn how to use Section Wizard to create fields and configure layouts for your preferences.

Register Here

Like 0

Like

Share

1 comments

3 AM my country time, so I will wait to webinar's record

Show all comments

Hi Community,

How we can set up the section fields per role or per user on back end.

 

Like 0

Like

1 comments

Dear Fulgen,

The table that stores all the data about each user section/detail columns sectings, etc is SysProfileData table. You would need find the correct section by Key column in this table and update the SysUserId column with the required role/user id taken from SysAdminUnit table. 

Best regards,

Dean

Show all comments