Announcement

Collapse
No announcement yet.

Color by regex/filter in "Record list" in dashlets

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Color by regex/filter in "Record list" in dashlets

    Hey there,
    i don't know if this should be a feature-request or a question solvable via some simple extension or so...

    I would love to be able to set a Coloring for Records in Record-Lists based on some collumn, like in this example invoices that are due should be highlighted red and yellow, when soon to be.:

    Click image for larger version  Name:	Bildschirmfoto am 2023-07-31 um 14.26.58.png Views:	0 Size:	57.2 KB ID:	96046
    insted of none of course
    Click image for larger version  Name:	Bildschirmfoto am 2023-07-31 um 14.25.20.png Views:	0 Size:	57.7 KB ID:	96047

    How would this be possible to acchieve? Should one write an extension or what?

    Help very much appreciated. Thank you all!

  • #2
    That's a very good feature idea. It would be a perfect feature to be able to color the record row in List view by a criteria or report (advanced pack).

    Comment


    • #3
      An Enum field can be displayed as a colored label. See the Priority field of the Case entity type for an example. Urgent priority is displayed as a red label, it draws attention enough.

      You can have a formula script and/or a scheduled workflow that will change your enum field value based on criteria. E.g. if now > dateEnd then change status to Overdue.

      Colored list rows unlikely to be implemented. I don't find them matching the style of Espo. It's an additional burden to maintain many colors for all themes plus compatibility with all possible colored labels that may be displayed on the row.
      Last edited by yuri; 07-31-2023, 01:52 PM.

      Comment


      • #4
        Okay, where am i going wrong...:
        As you said i added a enum "prioritystatus" on invoices and added it to my Record List.
        I created this simple script to update a invoice-priority as you suggested and put it in a workflow.

        HTML Code:
        ifThen(
            datetime\diff(datetime\now(), dateInvoiced, "days") > 12,
            prioritystatus = "Erhöhte Dringlichkeit",
        );
        ifThen(
            datetime\diff(datetime\now(), dateInvoiced, "days") > 14,
            prioritystatus = "Hohe Dringlichkeit",
        );​
        Now in the Script-Sandbox this works just fine when applied to a certain Invoice but in the workflow (where it should look at all the invoices) it doesn't.
        My Workflow is configured as follows:
        • Target Entity/Module "Invoices"
        • Triggertype: "Schedulled"
        • Target Report: "Any old Report"
        • Timing: "* * * * *"​

        Comment


        • #5
          in your workflow did you add the code to a script task ? or added an action update target record? Use action update target record with the code below:

          PHP Code:
          ifThen(
              
          datetime\diff(datetime\now(), dateInvoiced"days") > 12,
              
          entity\setAttribute('prioritystatus'"Erhöhte Dringlichkeit")
          );
          ifThen(
              
          datetime\diff(datetime\now(), dateInvoiced"days") > 14,
              
          entity\setAttribute('prioritystatus'"Hohe Dringlichkeit")
          );
          ​ 

          Comment


          • #6
            rabii I added your changes, thanks! But somehow my workflow does not run at all it seems... how can i continue debugging this? E-Mails (via Test-Mail) are working (though i dont know if thiis is proof that cron works...) I added a Notification to the workflow but that notification does not show...

            Comment


            • #7
              hey arrestthepresident

              make sure that the job (Run Scheduled Workflows) is active and running. also make sure on the workflow to enable/activate (Apply timezone) so that the workflow will run based on the default timezone of the app otherwise it will use UTC.

              Comment


              • #8
                hello again, you were right - the job didnt run which was due to the advanced pack beeing too outdated. I Updated it now and now the Job is running but i still cant get the script to do its job. I allready tried to alter it´s syntax and logic but still no luck. in the protocoll below there are invoices that dont even have the status "In Review". How come?

                Can please anybody give me a Tipp how to debug this? If only i could output some debug-Info from this script i would maybe understand this whole workflow-thing better...

                Click image for larger version

Name:	Bildschirmfoto am 2023-08-07 um 11.55.29.png
Views:	139
Size:	54.2 KB
ID:	96206

                Comment


                • rabii
                  rabii commented
                  Editing a comment
                  Try to enable Timezone so that the cron will be run based on your current timezone if not enabled by default espocrm will run under UTC (also make sure you have configured the correct timezone on your setting). i would advised to change the execution of the workflow running every minute is too much, you want this to run maybe once a day or so.

                • Jakub Grufik
                  Jakub Grufik commented
                  Editing a comment
                  entity\attribute(status) passed argument needs to be string so you need to use it like this: entity\attribute('status') same for dateInvoiced

              • #9
                also when using entity\attribute you need to wrap the attribute like this
                PHP Code:
                entity\attribute('assignedUserId'
                Or
                PHP Code:
                entity\attribute('status'

                Comment


                • #10
                  I have double checked and found out that on the latest version of advanced pack the job Run Scheduled Workflows run every 10 minutes that why when you set up your workflow to run every minutes it won't work, you can adjust your workflow to run every 15 minutes or any number of minutes bigger than 10 minutes, Or you can change the setting of the job Run Scheduled Workflows to run every minute

                  Comment


                  • #11
                    hey there, thanks y'all so far! the workflow is running i think, as there are entrys in the protocoll-section below the workflow. unfortunately the invoices or better their prioritystatus are not updating... my script sofar looks like this:

                    HTML Code:
                    ifThen(
                    (datetime\diff(datetime\now(), entity\attribute('dateInvoiced'), 'days') > 12) && (entity\attribute('status') == 'In Review'),
                    entity\setAttribute('prioritystatus', 'Erhöhte Dringlichkeit')
                    );
                    
                    ifThen(
                    (datetime\diff(datetime\now(), entity\attribute('dateInvoiced'), 'days') > 14) && (entity\attribute('status') == 'In Review'),
                    entity\setAttribute('prioritystatus', 'Hohe Dringlichkeit')
                    );​

                    Comment


                    • arrestthepresident
                      arrestthepresident commented
                      Editing a comment
                      the Logs are:

                      [2023-08-10 16:32:02] WARNING: Enabled `jobRunInParallel` parameter requires pcntl and posix extensions.
                      [2023-08-10 16:32:02] DEBUG: Workflow\ActionManager: Start workflow rule ID [xxxa].
                      [2023-08-10 16:32:02] DEBUG: Workflow\Actions: Start [updateEntity] with cid [0] for entity [Invoice, xxxa1].
                      [2023-08-10 16:32:02] DEBUG: Workflow\Actions: End [updateEntity] with cid [0] for entity [Invoice, xxxa1].
                      [2023-08-10 16:32:02] DEBUG: Workflow\ActionManager: End workflow rule ID [xxxa].

                      [2023-08-10 16:32:02] DEBUG: Workflow\ActionManager: Start workflow rule ID [xxxa].
                      [2023-08-10 16:32:02] DEBUG: Workflow\Actions: Start [updateEntity] with cid [0] for entity [Invoice, xxxa2].
                      [2023-08-10 16:32:02] DEBUG: Workflow\Actions: End [updateEntity] with cid [0] for entity [Invoice, xxxa2].
                      [2023-08-10 16:32:02] DEBUG: Workflow\ActionManager: End workflow rule ID [xxxa].

                      ...
                      [2023-08-10 16:32:02] DEBUG: Workflow\ActionManager: Start workflow rule ID [xxxa].
                      [2023-08-10 16:32:02] DEBUG: Workflow\Actions: Start [updateEntity] with cid [0] for entity [Invoice, xxxax].
                      [2023-08-10 16:32:02] DEBUG: Workflow\Actions: End [updateEntity] with cid [0] for entity [Invoice, xxxax].
                      [2023-08-10 16:32:02] DEBUG: Workflow\ActionManager: End workflow rule ID [xxxa].

                      [2023-08-10 16:32:03] DEBUG: BPM: processPendingFlows
                      [2023-08-10 16:32:03] DEBUG: BPM: processTriggeredSignals

                    • arrestthepresident
                      arrestthepresident commented
                      Editing a comment
                      Also running:

                      1. entity\setAttribute('prioritystatus', 'Hohe Dringlichkeit');

                      in the Sandbox updates the value correctly and

                      2. output\print((datetime\diff(datetime\now(), entity\attribute('dateInvoiced'), 'days') > 12) && (entity\attribute('status') == 'In Review'));

                      outputs 'true' when given Invoice is (A) status "In Review" AND (B) is due and false if any other than this.

                      So why are the Invoices not beeing changed by the workflow then? Should'nt i work the same for one specific Invoice as for a Workflow that deals with all possible Invoices??

                  • #12
                    SOLVED!:

                    The Problem was the Report.

                    You need to create a list report showing records that met specific criteria. You can specify any columns for the report, it doesn't matter.
                    (rel.: https://docs.espocrm.com/administrat...ows/#scheduled)

                    Columns dont matter.. yes... but filters do.: i had selected a report that handled the entity Invoices but it filtered them. I now created a new raw report on Invoices and now it works on all of them. I clearly misread the docs, but i think this should be worded more clearly.

                    THANK YOU ALL! <3

                    Comment


                    • arrestthepresident
                      arrestthepresident commented
                      Editing a comment
                      i recon this may be to pre-filter the records and then run the workflow based on this... i did not understand this.

                      So i maybe i should filter for "In Review" and then test the 'age' of the record and update the priority according...
                  Working...
                  X