Workflow to Update Contact Status With Campaign Log Record Action

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • tobias
    Senior Member
    • May 2016
    • 229

    Workflow to Update Contact Status With Campaign Log Record Action

    Currently, we're manually updating the field "status" of a contact with the latest "action" of the campaign log record , using this query:

    Code:
    update contact
    set contact.status = ifnull([INDENT](select lower(campaign_log_record.action)
    from campaign_log_record
    where campaign_log_record.parent_id = contact.id
    order by campaign_log_record.action_date desc
    limit 1), 'cold')[/INDENT]
      where contact.do_not_contact = 0 
     and contact.deleted = 0;
    We've recently purchased the Advanced Pack to get this job done whenever a new campaign log record is being created. However, we cannot find a way to reflect the above query using a Workflow.

    How is this supposed to be done in EspoCRM?
  • tanya
    Senior Member
    • Jun 2014
    • 4308

    #2
    Hello

    For now it is not possible to update parent entity. The only way for now is to use Run Workflow Service action (https://www.espocrm.com/features/add...-for-workflow/) for Campaign Log Record, triggered after record created

    Comment

    • tanya
      Senior Member
      • Jun 2014
      • 4308

      #3
      since version 1.25.0 you can update parent with workflow
      Originally posted by yurikuzn
      New version 1.25.0.

      What's new:
      * Workflows: Ability to specify Reply-To address in Send Email action.
      * Workflows: Supporting parent relationship type in Update Related Entity action.
      * Report: Supporting address fields in list report columns.
      * Report: Supporting grouping by week (w/ EspoCRM version 4.8.0 and greater);
      * Report: Supporting WEEK function in complex expressions (w/ EspoCRM 4.8.0 version and greater).

      Comment

      • tobias
        Senior Member
        • May 2016
        • 229

        #4
        Hi Tanya,

        When trying to add an action to "Update Related Entity" of type "Parent", we receive the following JS error:

        Code:
        VM1989:145 Uncaught Error
            at n.setupScope (eval at _execute (espo.min.js?r=1503290339:16), <anonymous>:145:27)
            at n.handleLink (eval at _execute (espo.min.js?r=1503290339:16), <anonymous>:223:18)
            at n.changeLinkAction (eval at _execute (espo.min.js?r=1503290339:16), <anonymous>:195:18)
            at n.change [name="link"] (eval at _execute (espo.min.js?r=1503290339:16), <anonymous>:30:22)
            at HTMLDivElement.dispatch (espo.min.js?r=1503290339:3)
            at HTMLDivElement.r.handle (espo.min.js?r=1503290339:3)
        We use Espo Version 4.8.0 and Advanced Pack Version 1.25.0.

        Any suggestions?

        Comment

        • tarasm
          Super Moderator
          • Mar 2014
          • 573

          #5
          It seems like for Campaign Log this not works (e.g. for Meeting it works fine). This will be fixed a new release.
          Job Offers and Requests

          Comment

          • tobias
            Senior Member
            • May 2016
            • 229

            #6
            Thanks for the reply.

            When do you expect the new version to be released?

            Comment

            • tarasm
              Super Moderator
              • Mar 2014
              • 573

              #7
              I think, this week
              Job Offers and Requests

              Comment

              • tarasm
                Super Moderator
                • Mar 2014
                • 573

                #8
                New version is released.
                Job Offers and Requests

                Comment

                • tobias
                  Senior Member
                  • May 2016
                  • 229

                  #9
                  Thanks for the update.

                  However, "Update Related Entity" for "Parent" still won't work for type "Campaign Log Record" - this is the JS error we see in the Console:

                  Code:
                  VM3333:145 Uncaught Error
                      at n.setupScope (eval at _execute (espo.min.js?r=1504518637:16), <anonymous>:145:27)
                      at n.handleLink (eval at _execute (espo.min.js?r=1504518637:16), <anonymous>:223:18)
                      at n.changeLinkAction (eval at _execute (espo.min.js?r=1504518637:16), <anonymous>:195:18)
                      at n.change [name="link"] (eval at _execute (espo.min.js?r=1504518637:16), <anonymous>:30:22)
                      at HTMLDivElement.dispatch (espo.min.js?r=1504518637:3)
                      at HTMLDivElement.r.handle (espo.min.js?r=1504518637:3)
                  setupScope @ VM3333:145
                  handleLink @ VM3334:223
                  changeLinkAction @ VM3333:195
                  change [name="link"] @ VM3334:30
                  dispatch @ espo.min.js?r=1504518637:3
                  r.handle @ espo.min.js?r=1504518637:3
                  Any ideas?
                  Last edited by tobias; 09-04-2017, 10:35 AM.

                  Comment

                  • tarasm
                    Super Moderator
                    • Mar 2014
                    • 573

                    #10
                    For me, it works fine. Could you reproduce this error on the demo http://demo.espocrm.de/advanced/.
                    Perhaps, try to clear cache (Menu > clear local cache).
                    Job Offers and Requests

                    Comment

                    • tobias
                      Senior Member
                      • May 2016
                      • 229

                      #11
                      Couldn't reproduce on the demo, where it's properly working.

                      Of course we cleared cache and also ran rebuild.

                      Any other ideas?

                      Comment

                      • tanya
                        Senior Member
                        • Jun 2014
                        • 4308

                        #12
                        did you do any customization? check also espocrm log

                        Comment

                        • tobias
                          Senior Member
                          • May 2016
                          • 229

                          #13
                          Yes, we did some customising - please check below.

                          Anything that could cause the problem?

                          ---

                          1) Increase number of monitored inboxes (maxLength:2000)

                          http://forum.espocrm.com/forum/gener...ng-sub-folders - also, set `varchar(2000)` in column `monitored_folders` in table `email_account`
                          vi crm/application/Espo/Resources/metadata/entityDefs/InboundEmail.json

                          Code:
                          "monitoredFolders": { "type": "varchar", "default": "INBOX", "view": "views/inbound-email/fields/folders", "tooltip": true, "maxLength":2000 },
                          2) Show "Select Template" field in reply view

                          http://forum.espocrm.com/forum/featu...ate-in-a-reply

                          vi crm/client/src/views/email/detail.js

                          3) Apply patch to fetch e-mails containing non-ascii chars

                          https://github.com/zendframework/zen.../pull/78/files
                          vi crm/vendor/zendframework/zend-mail/src/Header/HeaderWrap.php

                          4) Make Industry Multi-Enum for Lead Entity

                          DB: Make field 'industry' longtext

                          vi crm/application/Espo/Modules/Crm/Resources/metadata/entityDefs/Lead.json

                          Code:
                          "industry": { "type": "multiEnum",
                          vi crm/client/modules/crm/src/views/lead/fields/industry.js

                          Code:
                          Espo.define('crm:views/lead/fields/industry', 'views/fields/multi-enum', function (Dep) {
                          5) Make Industry Multi-Enum for Account Entity:

                          DB: Make field 'industry' longtext

                          vi crm/custom/Espo/Custom/Resources/metadata/entityDefs/Account.json

                          Code:
                          "industry": { "type": "multiEnum",
                          6) Add Industry & Source to Contact Entity:

                          vi crm/application/Espo/Modules/Crm/Resources/metadata/entityDefs/Contact.json

                          Code:
                          "source": { "type": "enum", "options": ["", "Call", "Email", "Existing Customer", "Partner", "Public Relations", "Web Site", "Campaign", "Other"], "default": "" },
                          "industry": { "type": "multiEnum", "view": "crm:views/lead/fields/industry", "customizationOptionsDisabled": true, "default": "", "isSorted": true },

                          vi crm/custom/Espo/Custom/Resources/metadata/entityDefs/Contact.json


                          Code:
                          "source": { "type": "enum", "options": [ "", "App Store", "Web Site", "Event", "Email", "Existing Customer", "Partner", "Call", "Family & Friends", "Public Relations", "Campaign", "Other" ], "required": false }
                          7) Link Contact Type with Lead Type


                          vi crm/application/Espo/Modules/Crm/Resources/metadata/entityDefs/Contact.json

                          Code:
                          "type": { "type": "multiEnum", "view": "crm:views/lead/fields/type", "customizationOptionsDisabled": true, "default": "", "isSorted": true },
                          vi crm/custom/Espo/Custom/Resources/metadata/entityDefs/Contact.json

                          Code:
                          "type": { "type": "multiEnum", "required": false, "audited": false, "readOnly": false, "tooltip": false }
                          cp crm/client/modules/crm/src/views/lead/fields/industry.js client/modules/crm/src/views/lead/fields/type.js

                          vi crm/client/modules/crm/src/views/lead/fields/type.js

                          Code:
                          Espo.define('crm:views/lead/fields/type', 'views/fields/multi-enum', function (Dep) {
                          Last edited by tobias; 09-04-2017, 06:18 PM.

                          Comment

                          • tarasm
                            Super Moderator
                            • Mar 2014
                            • 573

                            #14
                            I think, these customization are not related with the error. Is this error only for Campaign Log Record? Also, try to login and test in another browser or on incognito mode.
                            Job Offers and Requests

                            Comment

                            • tobias
                              Senior Member
                              • May 2016
                              • 229

                              #15
                              Action "Update Related Entity" for "Parent" works well with "Call", "Task", "Meeting" and "E-Mail".

                              However, it wouldn't work with "Campaign Log Record" and "Note".

                              I've tried with incognito on Chrome and get the same error. Tried the same in Safari, but couldn't get Espo to run at all (the console reads "QuotaExceededError (DOM Exception 22): The quota has been exceeded.").

                              I've also cleared the local cache and application storage with no effect.

                              Any other ideas?

                              Comment

                              Working...