Hello!

 

I've been searching for documentation on how to access data in a column, from the database, but to no avail. To give you some sort of background, my Product object has a detail called Collateral. Users can add more collaterals - each having an allocation percentage. What I need is to create a function that gets from the database the allocation percentage of each Collateral added to the Product. How can I implement this with javascript?

Example: Product1 has 3 Collaterals added: Coll1, Coll2, Coll3.

How can I get, for Product1 the allocation percentage of each Collateral?

Also, where could I check more documentation on the available methods? For example, asyncValidate for javascript?

Like 1

Like

4 comments

Hi Maria,

 

You need to use ESQ to get the data from some record in the detail related to the section. In this case you need to get the Id of the current main record (where the detail is located) by using for example:

var currentRecordId = this.get("Id");

and then in the ESQ filter you need to specify this Id in the filtration ("CollateralsInProduct" should be replaced with your detail object code, "CollateralValue" should be replaced with the code of the column in the "CollateralsInProduct" object where the actual values are stored, "ProductId" should be replaced with the code of the column that connects you detail to the main product record):

var esq = Ext.create("Terrasoft.EntitySchemaQuery", {
    rootSchemaName: "CollateralsInProduct"
});
esq.addColumn("CollateralValue");
var esqFilter = esq.createColumnFilterWithParameter(Terrasoft.ComparisonType.EQUAL, "ProductId", currentRecordId);
esq.getEntityCollection(function (result) {
    if (result.success) {
        result.collection.each(function (item) {
            /* Process the collection elements. */
        });
    }
}, this);

As for more documentation on basic methods like asyncValidate - unfortunately we have none suitable one where all the methods are described. I will ask our Academy team to create this article where all the available methods and properties are described so anyone could easily search data they need, thank you for this suggestion.

Hi Maria,

I have an article outlining a simple place to start with EntitySchemaQuery (to query the database from client-side code) here: https://customerfx.com/article/an-introduction-to-performing-client-sid…

Also an article on using asyncValidate here: https://customerfx.com/article/asynchonous-validation-on-pages-in-creat…

Hope this helps get you started. 

Ryan

Oleg Drobina,

Thank you, your answer enlightened me very much. Though I have some trouble accessing the id of the product. 

Based on what you explained, 

In this case you need to get the Id of the current main record (where the detail is located) by using for example:

 var currentRecordId = this.get("Id");

I understood that through this line of code I am accessing the id of the product to which my collaterals are added. But by logging this id to the console, I noticed that each time it comes different. Is this the id of each collateral that I am adding? How can I get to the id of the product? That's what I am supposed to do, right?

Thank you so much for the attention.

For me, I usely add a debugger to the code. Then examine "this" In the console to see what values are already available.

Show all comments

Hello Creatio Community,

This happens in the Application Section. When i fill in the product terms and try to save the Application this pop up is shown. Meanwhile the object SysFinApplicationSpecRight doesnt exist at all in the database. How can I fix this problem ?

Regards

Like 0

Like

2 comments

Printscreen of Error Logs

 

Managed to solve the problem by re-compiling FinApplicationSpec

Show all comments

In database I have Order table and Product in Order Table. The Order table i have the same Order no but it not a same record because it order created a different day

Ex.

OrderNo : 0001 Created : 2022-01-21

OrderNo : 0001 Created : 2022-02-21

 

The problem is I cannot import Product in Order table data by match order no and date in Order table

 

 

How import data by excel file with same order no but different date and different record

Like 0

Like

1 comments

Maybe you could create a single column in Creatio to store order number + date, then in the Excel file use a formula to append the values together and map that value to link to the order? 

Ryan

Show all comments

Hello Community,

 

There are many use cases where we need to change the data type of a column. We have observed the following behavior wrt data type changes and want to understand why this happens.



DB - MS SQL



Behavior #1

Say a column has been created as String(250) and published. Changing it to String(50) via the Object designer and re-publishing it does not change the data type at the data base level - even though it reflects correctly in the Package (We also verified that there is no data in the DB which exceeds 50 characters. So technically, it can be downgraded to 50 characters without loss of data). We are forced to alter the column at the database level to actually downgrade it to String(50).



Behavior #2

On the flipside, a data type change from String to Int does work. Additionally, it downgrades the column from NOT NULL to NULLable type in the Database when the String to Int conversion happens.

  1. Can someone string together the above 2 behaviors and why one happens and the other doesn't?
  2. Is there knowledge within the community as to what data type changes work and what do not? If yes, Pls share your experiences.

Note - I am aware that the earlier column can be dropped and a new column with the new data type be created. But this is not practical, if we want to retain the same name. 

Like 0

Like

4 comments

Hello,

 

Hope you're doing well.

 

We tried to reproduce the behavior you have described for different types of DB (PostgreSQL and MSSQL) in two ways:

1. Create a column via Page Designer.

2. Create the column in Object Designer.

 

At first, we have set the string length 250 for the 1st column, then changed it to 50 in the Object Designer and published the object:

 

 

 

As a result we could see that the data type has been changed from varchar(250) to varchar(50):

 

 

Then we have repeated the same actions for another test column (added via Object designer) and result was the same:

 

 

 

 

 

That's why it would be really helpful if you could confirm if we were doing the reproducing correctly (maybe we should use another version or another product). Also, we can provide you with a fresh installation files so you can try to re-check it from your side once again (for that just contact our support team via this email: support@creatio.com).

 

About the second question: in general, we do not recommend to change field types. The system can transfer data type from one char to another when you need to change the length of the field. But it may behave unpredictably when the type is changed from one object to another.

Alos you can find some addtional information about data types in the links below:

 

Best regards,

Roman

Roman Rak,

Hi Roman, Appreciate your effort in trying to reproduce this.



Your steps does look right - 

1. Create as 250 in Object designer. Publish and check if the DB shows nvarchar(250).

2. Change to 50 in Object designer. Publish and check if the DB has changed to nvarchar(50).



I have verified this on 2 Creatio versions - 7.15.2 Studio and 7.16.3 CustomerCenter (Both MS SQL). Is is possible that this got fixed/changed in the latest 7.17 release?? Il also reach out to Creatio support ato replicate this in the latest release.

M Shrikanth,

 

As for your question - no, it was not changed in the latest versions.



Best Regards,

Ivanna Yatsura

Roman Rak,



Hi Roman. Checked this use case once again. The behavior I have stated in my question is correct. I have used a on-premises Creatio sales v7.17 on MSSQL. The datatype does change if you increase the length (Eg 50 to 250) but not from 250 to 50.



Have you checked this on an on-premises or trial instance??

Show all comments

Hello community,

 

There are numerous use cases where Creatio filters for some data before showing on the UI. Few examples below - 

  1. Writing ESQ from JavaScript where we filter an object for only select records by adding filter groups. 
  2. User applying of a filter in a section list page or a detail. 
  3. When we add a detail to a Section record page, we map a column from the detail to a column in a section record. This is how Creatio filters for only the detail records belonging to that section record and displays the records subsequently. 

Few questions below which will help us explain Creatio better with our customers- 

  1. At which layer does Creatio execute these filters? Is it at the Application layer or at the Database layer? It is unlikely that it is at the App layer. Can you confirm that these happen at the DB layer and only the filtered records are fetched to the App layer and subsequently passed back to the UI?
  2. I am guessing that the Creatio ORM would aggregate all of the filters and frame a query which filters for the required data and then execute this at the DB layer? Excuse the over-simplification. Can you confirm and share a few more details on how this done? This would give us insight into the Product architecture and help us understand the product better.

If these insights are already available in the Documentation, Request you to share the link. Thanks in advance!

Like 1

Like

5 comments

Hello,

Yes, all filter conditions are added as conditions for queries and are performed at the database layer. You can see this if you install Creatio locally and run SQL profiler. You'll notice as an ESQ gets executed that ultimately this is translated to a SQL query with the filter conditions in the where clause.

Additionally, as a related side topic to mention to your original question which might be of interest, you can also create SQL views in the database containing aggregates/joins/unions/ranks/partions/etc and create an entity/object for that view. These objects can then be used normally in section lists, details, dashboards, reports/printables, and even read via OData/DataService APIs etc. This is a fantastic way to create what would be a complex or time consuming query and make the results readily available in the client.

Hope this helps with your question.

Ryan

Hello Shrikanth,

 

We can confirm that filtering conditions are configured as conditions for queries and they are being performed on the DB layer, but not the application layer.

 

We will ask the responsible team to add more information relateable to this kind of topic to the Academy. At the same time, please check the articles included in this section, they should be useful for further development operations:

https://academy.creatio.com/docs/developer/back-end_development

 

Thank you Ryan for your help!

 

Best regards,

Roman

Ryan Farley,

Thank you Ryan. Yes, I was aware of the views and similarly noticed usage of Stored procedures in the community. This prompted my question. 

Roman Rak,

Thank you Roman for the answer.

Ryan Farley,

 

If I can quote:

you can also create SQL views in the database containing aggregates/joins/unions/ranks/partions/etc and create an entity/object for that view

If I were to create a SQL view, how would I create an entity/object of the view?  Thanks,

 

[Edit]

I think I have the answer here Creating View Type Object in Creatio | Community Creatio

Show all comments

Hello community,

 

Earlier, we would not be able to access the database directly on Creatio SaaS cloud installations and would have to reach out to Creatio support for any assistance. Does this still continue or is there a roadmap to enable direct database access even in the Creatio cloud offering?

 

If we still do not have access,

  1. How does one approach enterprise level heavy volume data migrations in the context of the Cloud? Typically these are done directly through the Database either via SQL scripts or via ETL tools. 
  2. We are aware of ETL plugins like Starfish ETL, we want to understand options besides that - where access & control at the database layer is required to execute these migrations. How have other customers handled this scenario?
Like 1

Like

4 comments

Dear Shrikanth,

 

Due to security reasons the direct access to the databases is not available. If there is a necessity to migrate some data from\to Creatio - the enterprise level customers use different integrations via webservices, OOTB API and Odata, DB server linking, ftp\sftp storages and different custom API integrations. SQL scripts can be also involved.  

The direct connection with our cloud and customer's storages is never set up due to the security policies. Usually there can be some shared storage where customers send their data and it is imported into our cloud.  As for Starfish ETL, it is also used but not frequently. Usually enterprises use their own integrations.

 

Regards,

Dean

Dean Parrett,

 

Could you elaborate on the "DB Server Linking" part here, Dean? Thanks

Dear Amanthena,

 

This is typical on-site\non-cloud integration. It's basically looks like this:

Creatio database<--->buffer database<--->customer's storage.

Typically the buffer database is kind of shared storage for customer and Creatio used to import and export data to both sides. It is typically used on regular basis rather than one time data migration.   It has some particular access rules assigned to the required tables. It is not usually used for migrating data into Cloud database due to some security limitations, however some enterprise customers have similar solutions where Web server is connected to similar storage and it pulls data into Creatio. Again, server linking is not really commonly used for cloud integration solutions, however, under some conditions, specific setup and prior negotiation with cloud team- it may be possible. If you are interested in it, I suggest you to discuss it with your account manager.

 

Regards,

Dean    

I have done data migrations directly to the database on several occasions with no issues. The most challenging part is the creation of the access rights records (well, not really challenging once you figure out the RightLevel 0=read/1=edit/3=delete, Position, SourceId=user/role values, but something to be aware of). Each table has a separate table that stores access rights for the records, for example for Contact it stores it's access rights records in SysContactRight. For objects with record level permissions, you need to create these records to give read/edit/delete permissions to the records. However, in recent versions of Creatio the object permissions propagate to records nicely, so I would likely turn off record access rights for the migration, then set afterwords and let Creatio do that work. 

In my scenario, I had a customer with multiple millions of records. They are cloud hosted, so I had support provide me with a database backup, I performed the migration, then provided the complete database loaded with data back to support as a backup and they put in place on the cloud again. This was significantly faster to load using SQL inserts from selects etc than loading record by record via the API. Keep in mind that if a customer is first a cloud customer, the backup you get from support is likely going to be a Postgresql database, not MSSQL. In another scenario, with Creatio on premise, creating views that combine data from other SQL databases and exposing as objects in Creatio was very straightforward as well.

Hope this helps.

Ryan

Show all comments

Hi Community,

I'm trying to understand the behavior of Creatio with Indexed / Non-Indexed databases. Does Creatio handle database indexing by default? If yes, which are the default fields that are indexed?

 

Also, can a Non-Indexed database affect Creatio's performance considering a production environment? Or does indexing only affect direct DB scripts configured in the packages?

 

Thanks in advance.

Like 2

Like

1 comments

Hello Halludeen,

 

Hope you're doing well.

 

By default, the Creatio application can handle the database indexing. For cloud solutions, we arrange the defragmentation of indexes every day to provide stable site productivity. For on-site deployments, indexing should be configured by the client's/partner's DBA. In the second case, index defragmenting should be done for all available indexes (you can skip this operation for clustered indexes, as it doesn't make a big difference before).

 

About the non-indexed database, the application also can work with a kind of DB, but we can not assure that the application performance will be as fast as with indexed DB. That's why we recommend to perform index operation for DB records at least once per month.

 

Thank you for your questions.

 

Best regards,

Roman

Show all comments

Creatio by default allows a user to choose between 50, 250 and 500 as max lengths of a Text column from the Object designer. In a use case where Creatio co-exists with an external system and both share the same fields, it becomes important to maintain consistency with respect to data types and lengths.



Right now, the only way to enforce a custom length (say String(8)) is to implement field validators on the Creatio GUI and write custom code to validate any input received via server side integrations. However, the field in the DB would still have 50, 250 or 500 as the length. This is not ideal. 

 

It would be very useful to permit defining custom lengths of fields Eg String(8) from the Object designer which directly creates those custom lengths in the database. 

1 comments

Hello Shrikanth,

 

Hope you're doing well.

 

Thank you for being interested in the Creatio application and further its improvements. We have created a functional request and passed it to our R&D team. After additional review, if the request will be in high demand this kind of functionality will be implemented in the future versions of the application and the users will be able to permit defining custom lengths of the needed fields without adding the custom code.

 

We appreciate your cooperation!

 

Best regards,

Roman

Show all comments

When I try to implement esq and multiple filters, only last added filter will work. Rest will be kind of overrided by the next filter.

For example, If I use 3 filters - 


esq.filters.add(esqFirstFilter);
esq.filters.add(esqSecondFilter);
esq.filters.add(esqThirdFilter);

I am getting results on the basis of last filter.

If I use 2 filters - 

 

esq.filters.add(esqFirstFilter);
esq.filters.add(esqSecondFilter);

 

Then last filter esqSecondFilter will filter the records not the first one. And I need both filters.

Is there anything need to be added to this code snippet - before or after.

 

Like 0

Like

1 comments

Dear Ramnath,

 

In order to resolve the issue please use the following code for adding filters:

 

esq.filters.add("esqFirstFilter", esqFirstFilter);

esq.filters.add("esqSecondFilter", esqSecondFilter);

 

Please find more information about esq filters in the article by the link below:

 

https://academy.creatio.com/documents/technic-sdk/7-16/entityschemaquery-class-filters-handling

 

Best regards,

Norton

Show all comments

Dear mates,

I would like to modifiy our timelines on differents pages.

I try to follow the guide: https://academy.creatio.com/documents/technic-sdk/7-13/timeline-tab

But i can not access the database to do the modifications.

How can we have an access to the database ?

Thanks,

Nicolas

Like 0

Like

1 comments

Hello Nicolas,

 

This method is only good for the development environments deployed on-site. Since the modifications are implemented directly in the database, they are not bound to any package. That is why the modifications will not be implemented in the database if the package with the view models and the tile view models is installed into another application. For the correct transfer of the developed functions, you need to bind the SQL-scripts that implement the corresponding modifications in the database when installing the package.

 

Best regards, 

Olga. 

Show all comments