Question

Override case numbering function of case registration

Hi Community,

 

Case can be registered from case section, incoming email and mobile application. Case number is being populated automatically. We need to give different prefix for each. Currently all prefix are coming from system setting "Case number mask" and is being applied for all Cases. 

 

Please let us know to where we can find this function and how we can override it for us to customize it based on our requirements.

 

Thank you so much

Like 0

Like

6 comments

Hello Fulgen,

 

Thank you for your question!

 

This logic can be achieved with the help of a business process. Please see the screenshot below:

It should start with a signal Case Added (when a new case is created). The next element would be Read Data which will read all the data from the case. The data should be read from Category, ID, and Number columns. Please, don't forget to filter the cases by ID. Alternatively, the system will not understand which case to choose and will select the first available one.

 

Also, you need to set the following parameters here:

NewCaseNumber - Text (500 characters)

OldCaseNumber - Text (500 characters)

Prefix - Text (500 characters)

 

The next element would be Formula which will be dividing your cases in different flows. You will need to add the conditions according to which you would like to group your cases here. Please, select case category in order to separate the cases by the source they are registered from.

When setting up Formula element (#2), you will need to set the formula value to the following parameter: OldCaseNumber. The Formula value here will be [#Read case. First item of resulting collection.Number#]

 

The conditional flow (#3) should be filled in this way: [#Read case. First item of resulting collection.Category#]==[#Lookup.Case category.Incident.1b0bc159-150a-e111-a31b-00155d04c01d#]

 

The conditional flow (#4) is a default flow.

 

In Formula element (#5) you need to set the formula value to the following parameter: Prefix. The Formula value here will be, for example, “HY” (the needed prefix).

 

In Formula element (#6), please do the same as in the previous element, just set another prefix.

 

The seventh element is Script task (#7), its code is:

string oldCaseNumber = Get<string>("OldCaseNumber");

string prefixValue = Get<string>("Prefix");

string resultNumber = oldCaseNumber.Replace("SR", prefixValue);

Set<string>("NewCaseNumber", resultNumber);

return true;

 

The eighth element is Modify Data (#8) which will finally change the prefix. Please, filter the cases here by ID as well. In the field ‘Which column values to set for modified records please type [#NewCaseNumber#].

 

You can customize the process based on your tasks, but the basic structure is described above.

 

Hope this helps!

 

Kind regards,

Anastasiia

Anastasiia Lazurenko,



Thank you for your suggestion but I want to override the function before insert. From there I wanted to change the Case Number right away. Please guide me how can I override it?

Fulgen Ninofranco,

 

 You can either create a database trigger or you can create the same process that is triggered upon CaseInserting event in the Case object of the Case package, but in your custom package and change the logic of the sequence:

We don't have a practical example of the implementation so you will need to study the logic of this process and create your own process in the same way if you select EntityEvent option.

 

Best regards,

Oscar

Fulgen Ninofranco,

Oscar is pointing you to the correct direction.

 

Regarding the business case you mentioned, you can:

1. Remove the prefix in the system setting. Therefore no prefix will be attached to you case number, which is generated from the user task.



2. Create exact the same process as Oscar mentioned above. 

In the last step, "SetGeneratedNumberScript" apply your logic.

string code = string.Empty;

code = GenerateNumberUserTask.ResultCode;

//Apply your business logic for the prefix and attach the prefix to the generated code. So code = LogicPreifx + code;

if(!string.IsNullOrEmpty(code)) {

    Entity.SetColumnValue("Number", code);

}

return true;

 

Be careful that the case number will be will be generated on UI when you click on new case. So you need to disable the code generation on page or apply the same logic.

 

regards,

 

Cheng gong

 

 

Dear Fulgen, you have another choice, flexible on the Marketplace, is free, see it on https://marketplace.creatio.com/app/numerator-creatio

Hi Oscar Dylan,

I tried to follow your suggestion, in a standard package (no assembly package) I overrided the CaseInserting event by adding my business logic, but it doesn't work, the application calls the original version.

 

Show all comments