Case numeration

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • partomas
    Active Community Member
    • Sep 2018
    • 331

    Case numeration

    I have encountered an issue when communicating with other companies' support systems via email.

    Currently, our CRM system generates case numbers in the subject line using the format [#26854]. However, when we send emails to other companies that also use CRM systems, which generate similar case numbers with the "#" symbol, responses often get mixed up or lost between our system and theirs.

    Could you please advise how we can change the "#" symbol to something like "CASE_" or another unique identifier in our system to avoid confusion and ensure proper tracking of cases across different systems?
  • rabii
    Active Community Member
    • Jun 2016
    • 1250

    #2
    Hey @patomas

    You can create your own custom activities panel for the case entity and just copy and past existing code with modification you need, one downside to this approaches is that you have to provide all panels in custom entityDefs as you are not appending but customising existing panel of activities. Below steps to achieve this:

    1 - create custom\Espo\Custom\Resources\metadata\clientDefs\C ase.json (if it doesn't exist, otherwise just use the code of section sidePanels from the code below).
    PHP Code:
    {
        "sidePanels":{
            "detail":[
                 {
                    "name":"activities",
                    "label":"Activities",
                    "view":"custom:views/case/record/panels/activities",
                    "aclScope": "Activities"
                 },
                 {
                    "name":"history",
                    "label":"History",
                    "view":"crm:views/record/panels/history",
                    "aclScope": "Activities"
                 },
                 {
                    "name":"tasks",
                    "label":"Tasks",
                    "view":"crm:views/record/panels/tasks",
                    "aclScope": "Task"
                 }
            ],
            "detailSmall":[
                 {
                    "name":"activities",
                    "label":"Activities",
                    "view":"custom:views/case/record/panels/activities",
                    "aclScope": "Activities"
                 },
                 {
                    "name":"history",
                    "label":"History",
                    "view":"crm:views/record/panels/history",
                    "aclScope": "Activities"
                 },
                 {
                    "name":"tasks",
                    "label":"Tasks",
                    "view":"crm:views/record/panels/tasks",
                    "aclScope": "Task"
                 }
            ]
        }
    }


    Now you need to create the custom activities.js view under client\custom\src\views\case\record\panels\activit ies.js create the folders if don't exist (it is up to you how to structure your app folders) and just use the same code with a small change in # as below - will be extending the case original activities view just in case in future more function have been added.
    PHP Code:
    define('custom:views/case/record/panels/activities', ['crm:views/case/record/panels/activities'], function (Dep) {
    
        return Dep.extend({
    
            getComposeEmailAttributes: function (scope, data, callback) {
                data = data || {};
    
                Espo.Ui.notify(' ... ');
    
                Dep.prototype.getComposeEmailAttributes.call(this, scope, data, attributes => {
    
                    // Here instead of # i have changed it to CASE_ - you can change to what is you like.
                    // this will apply to only new case
                    attributes.name = '[CASE_' + this.model.get('number') + '] ' + this.model.get('name');
    
                    Espo.Ajax.getRequest('Case/action/emailAddressList?id=' + this.model.id).then(list => {
                        attributes.to = '';
                        attributes.cc = '';
                        attributes.nameHash = {};
    
                        list.forEach((item, i) => {
                            if (i === 0) {
                                attributes.to += item.emailAddress + ';';
                            } else {
                                attributes.cc += item.emailAddress + ';';
                            }
    
                            attributes.nameHash[item.emailAddress] = item.name;
                        });
    
                        Espo.Ui.notify(false);
    
                        callback.call(this, attributes);
                    });
                })
            },
        });
    });

    Once this is added. Clear cache and rebuild the system then go to an existing case and create email you will see the change in the subject.


    Hope this helps
    Rabii
    Web Dev

    Comment

    Working...