Hello,

 

I would like to know how to approach the task of extracting the model of field entities to a CSV  or Excel file.

The idea is to provide project managers with a simplified view of the fields available in my Creatio instance. I'm not looking for details, just the field name, code, label (translation?), data type.

 

Any sugestions on how to approach this task?

 

Thanks,

Vlad 

Like 0

Like

4 comments
Best reply

This marketplace addon will provide you with an Excel export of all obejcts in the system, along with columns, data types, display titles of objects and columns, etc. 

https://marketplace.creatio.com/app/object-structure-export-creatio

Once installed, there will be a process you can run that gives you the Excel file. 

Ryan

Hello!

 

You can check all the information about data export on Creatio Academy:
https://academy.creatio.com/docs/8.x/creatio-apps/creatio-basics/business-data/exporting-list-data-to-excel

Thank you for your reply Arsenii, but it is not the data that I am trying to export, but the model.

 

Exemple for Accounts entity:

 

field name; field code; field label; data type; default value

Name; Name; The company name; Text - 250 caracters; <empty>

Phone; Phone; Main phone number; Text - Phone number; <empty>

Web; Web; Compny Website; Text - Web link; <empty>

(...)

 

Kind regards,

Vlad

 

This marketplace addon will provide you with an Excel export of all obejcts in the system, along with columns, data types, display titles of objects and columns, etc. 

https://marketplace.creatio.com/app/object-structure-export-creatio

Once installed, there will be a process you can run that gives you the Excel file. 

Ryan

Ryan Farley,

Perfect, I'll give it a try. 

 

Thank you,

Vlad

Show all comments

Hello Everyone,

I am working on a scenario where I need to get Records (With Id and Name) from another object.

In Model class, we can get one record but how to get a Collection of records with a filter/Parameter "Name" it should get all the records with the same Name. 

 

Like 0

Like

4 comments

There is an issue in current versions of Creatio with the filter classes, such as FilterGroup etc, being applied to model load/queries. I've been reporting this issue since 8.0.6 (#SR-01182879) but it's still not yet fixed in 8.0.9, very frustrating (I've been told it will be fixed in 8.1 #SR-01198668 🤞🏻). However you can still use them with a small workaround. The example below will get all Accounts that have Type = Customer:

// make sure to add "@creatio-devkit/common" as sdk
 
const accountModel = await sdk.Model.create("Account");
 
const customerFilter = new sdk.FilterGroup();
await customerFilter.addSchemaColumnFilterWithParameter(sdk.ComparisonType.Equal, "Type.Name", "Customer");
 
// This is the workaround you have to do for the filters to work.
// Shallow copy to a new object and then reassign the items collection.
const newCustomerFilter = Object.assign({}, customerFilter);
newCustomerFilter.items = customerFilter.items;
 
// now use new shallow copied filters in the query
const customers = await accountModel.load({
    attributes: ["Id", "Name", "Type"],
    parameters: [{
        type: sdk.ModelParameterType.Filter,
        value: newCustomerFilter
    }]
});
 
// the customers variable is now an array of accounts with Id, Name, and Type columns
console.log(customers);

The whole issue with the FilterGroup is that the items collection doesn't get unrolled from a collection to an array - the copy forces the object to flatten out how it's expected by the underlying DataService call.

Ryan

Ryan = Creatio's code gap workaround master

Ryan Farley,

 

This is my code : 

handler: async (request, next) => {

        // Get the selected date values

        var dateFrom = new Date(await request.$context.DateTimeAttribute_6jtq65k);

        var dateTo = new Date(await request.$context.DateTimeAttribute_vg9eydm);

        var datesBetween = [];

          var currentDate = new Date(dateFrom);

          while (currentDate <= dateTo) {

        datesBetween.push(new Date(currentDate));

        currentDate.setDate(currentDate.getDate() + 1);

          }

  // Convert dates to integers without the time component

          var datesAsIntegers = datesBetween.map(date => {

        return parseInt(date.toISOString().slice(0, 10).replace(/-/g, ""), 10);

          });

        const accountModel = await sdk.Model.create("UsrEntity_a6e9b72");      

        // Load the accounts based on the filter.

        const accounts = await accountModel.load({

            attributes: ["DateTimeAttribute_x2whel6"],

        });

        console.log(accounts); 

            for (const value of accounts) 

            {

                for (const value1 of datesAsIntegers)

                {

                   const integerValue = parseInt(value1);

                value.NumberAttribute_ejh4wbq === integerValue;

                }

                console.log("1");

            }

return next?.handle(request);

        }

Here we are trying to get value of "NumberAttribute_ejh4wbq" but we are only getting "Id" .

Can you help us with this?

 

 

Verify that the column name is correct. In the accountModel.load your passing the attributes array with "DateTimeAttribute_x2whel6", this needs to be the column name in the object/table (which will likely start with a Usr)

Ryan

Show all comments