Hello Community,

Which is the best way to add a second unique field (of type text) in Creatio.

We have created a custom object which has its unique ID (GUID) and would like to have in the same object a second unique field of type (String).

One method I have thought is implementing the AutoIncrement number on the Server-Side. Is there another way ?

Sasori

Like 0

Like

2 comments

Hello Sasori,

 

If you want to add a second unique field of type text to a custom object in Creatio we recommending to use the [Autonumber] field, it provides an out-of-the-box feature  that allows you to generate unique identifiers automatically. You can configure an AutoNumber format for your custom object's second unique field and define rules for its generation. This approach can be useful if you want to have a consistent format for your unique identifiers.

Hi Bogdan,

Unfortunately we are still using the Classic UI for the specific Client and we dont have the AutoNumber functionality. 

I have already implemented https://academy.creatio.com/documents/technic-sdk/7-16/how-add-auto-numbering-edit-page-field?_gl=1*1b1tnxa*_gcl_au*Njc0NzQ5NzQ2LjE2ODE4MDc5Njk. the logic in this academy article. (Server-Side)

Will it satisfy my business need ?

Sasori

Show all comments

Hi All, 

 

I've created a lookup, when I Click "New" I can Add a value to it.

 

My question is: How to add only unique values to the lookup and prevent user from entering repeated value. 

 

Thank You.

Like 0

Like

2 comments

Hi Anas Iyad Ahmad Ibrahim,



For all the records that get inserted into the Creatio table (Objects: section, details, or Lookup) the inserted record is distinguished by the "Id" (GUID Type) column which is a unique identifier for the record.



If an additional column has to be considered into account before inserting a record, then a custom implementation has to be made to validate the additional field value.



Please click, view and select display columns and add Id, and Name. Then Id field will be displayed with a unique value for each record.





BR,

Bhoobalan Palanivelu.

Bhoobalan Palanivelu,

Thanks a lot

Show all comments

Hi Team,

 

I have added a custom lookup object to the order section and i added few lookup values. But in the record when i clicked on lookup field i want to display the available unique/distinct values.

 

Please find the attachments for reference.

 

Thanks in  advance!

 

Regards,

Bhoobalan P.

 

 

Expected Values:

Note:

I have used the below code but it doesnt work.

Like 0

Like

5 comments
Best reply

Hello Bhoobalan,

 

1. The best approach is to add a new column “Inactive” in the object, you can do this when you open the object in configuration, and in the behavior, section click in the checkbox “Allow records deactivation”

After that publish your object and go to the lookup section. Here in your lookup, you will see one additional column, called “Inactive”, for records you do not want to see, please fill in this checkbox.

After you will see only records in your dropdown that are not inactive.

 

2. Another approach that is not recommended is to implement filtering after you receive the collection of values. You should do this after receiving because you cannot apply isDistinct property for you select, because the Id for each record is different, so it will always return you all records. In your page (OrderPage) add one more method:

 

onLookupDataLoaded: function(config) {
    this.callParent(arguments);
    if (config.columnName === "YourColumnName") {
        var displayValues = [];
        Terrasoft.each(config.objects, function(item) {
            if (Ext.Array.contains(displayValues, item.displayValue)) {
                delete config.objects[item.value];
            } else {
                displayValues.push(item.displayValue);
            }
        }, this);
    }
}

Where YourColumnName is the column name in the object.

 

Best regards,

Bogdan S.

You can make this a popup selection, where you can display some other fields in the lookup which will help you to distinguish or filter proper value. For e.g. Order number +Account Name + City

KrishnaPrasad,

Thanks for the response.



This is a simple lookup field which has duplicate values. In a record if i click this i want to display the unique values of the lookup object.

 

Step 1 : I have created a lookup object

Step 2 : I haved added values for that lookup object (with duplicate entries)

Step 3 : but when i use that field in a section record i.e if i clicked that lookup field it is populating all the values of the lookup (including duplicate entries). Here i want the distinct vales to be shown.

 

Please find the attachment for reference!



Hello Bhoobalan,

 

1. The best approach is to add a new column “Inactive” in the object, you can do this when you open the object in configuration, and in the behavior, section click in the checkbox “Allow records deactivation”

After that publish your object and go to the lookup section. Here in your lookup, you will see one additional column, called “Inactive”, for records you do not want to see, please fill in this checkbox.

After you will see only records in your dropdown that are not inactive.

 

2. Another approach that is not recommended is to implement filtering after you receive the collection of values. You should do this after receiving because you cannot apply isDistinct property for you select, because the Id for each record is different, so it will always return you all records. In your page (OrderPage) add one more method:

 

onLookupDataLoaded: function(config) {
    this.callParent(arguments);
    if (config.columnName === "YourColumnName") {
        var displayValues = [];
        Terrasoft.each(config.objects, function(item) {
            if (Ext.Array.contains(displayValues, item.displayValue)) {
                delete config.objects[item.value];
            } else {
                displayValues.push(item.displayValue);
            }
        }, this);
    }
}

Where YourColumnName is the column name in the object.

 

Best regards,

Bogdan S.

Bogdan Spasibov,

Thanks much for the response!

onLookupDataLoaded: function(config) worked well.
I have similiar need in this below question too.

how to display distinct/unique values in multiselect lookup?

 

https://community.creatio.com/questions/display-column-distinct-values-…

 

Thanks in advance.

 

 

Regards,

Bhoobalan P.

Bhoobalan Palanivelu,

 

Please try the following code as an example: 

 

var esq = this.Ext.create(Terrasoft.EntitySchemaQuery, {
    rootSchemaName: "Activity"
});
esq.addAggregationSchemaColumn("DurationInMinutes",
Terrasoft.AggregationType.COUNT,
"UniqueActivitiesCount",
Terrasoft.AggregationEvalType.DISTINCT);

 

Terrasoft.AggregationEvalType.DISTINCT is the key part for your task that will allow filtering only distinct values. 

 

Regards,

Anastasiia

Show all comments