Problem with scheduled workflow

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Jakub Grufik
    Senior Member
    • Aug 2022
    • 361

    Problem with scheduled workflow

    Hello,
    I am currently facing an issue with the scheduled workflow.

    Workflow is being scheduled once a day and is targeting Leads from the report "Leads", where we have all the leads.

    However, workflow is being executed only for the first record in the report twice in a row for the same record and then nothing else is happening with other leads in the report. I have no idea why, because other workflows with the same settings are targeting all leads as expected.

    Screen1 - Workflow settings with logs
    Screen2 - Report records

    Do you guys have any idea why this could be happening, please?
    Attached Files
  • Jakub Grufik
    Senior Member
    • Aug 2022
    • 361

    #2
    Update: When I duplicated workflow and removed actions. Everything is working now and the workflow is targeting all the leads as expected.

    No idea why the action should make a workflow not be working properly. + It is somehow working, but only for the first record in the report and also twice in a row with no reason? I am confused now because I am not sure what exactly in that action is making it behave like this. The syntax looks correct.

    ifThen(datumDalsiAktivity < datetime\now(), upozorneniLeadu = '<p><font color="#000000" face="Verdana" style="background-color: rgb(240, 71, 71)">&nbsp;Zavolat: {datum}&nbsp;</font></p>'; upozorneniLeadu = string\replace(upozorneniLeadu, '{datum}', datetime\format(datumDalsiAktivity, 'Europe/Amsterdam', 'DD.MM.YYYY HH:mm')));

    ifThen(datetime\today() == datetime\format(datumDalsiAktivity, , 'YYYY-MM-DD'), upozorneniLeadu = '<p><font color="#000000" face="Verdana" style="background-color: rgb(255, 165, 0)">&nbsp;Zavolat: {datum}&nbsp;</font></p>'; upozorneniLeadu = string\replace(upozorneniLeadu, '{datum}', datetime\format(datumDalsiAktivity, 'Europe/Amsterdam', 'DD.MM.YYYY HH:mm')))​
    Attached Files

    Comment

    • Jakub Grufik
      Senior Member
      • Aug 2022
      • 361

      #3
      Even when I "cut" the action to half and use just the first half of it, it is still targeting only the first record in the target report and again twice in a row...
      I am clueless and desperate.
      Attached Files

      Comment

      • lazovic
        Super Moderator
        • Jan 2022
        • 809

        #4
        Hi Jakub Grufik,

        The problem is definitely not that this is a Workflow with a Scheduled Trigger Type. Most likely, you need to change formulas a bit. Try to use these ones:

        Code:
        ifThen(
             datumDalsiAktivity < datetime\now(),
             upozorneniLeadu = string\concatenate('<p><font color="#000000" face="Verdana" style="background-color: rgb(240, 71, 71)">&nbsp;Zavolat: ', datetime\format(datumDalsiAktivity, 'Europe/Amsterdam', 'DD.MM.YYYY HH:mm'), '&nbsp;</font></p>')
        );
        
        ifThen(
             datetime\today() == datetime\format(datumDalsiAktivity, 'Europe/Amsterdam', 'YYYY-MM-DD'),
             upozorneniLeadu = string\concatenate('<p><font color="#000000" face="Verdana" style="background-color: rgb(255, 165, 0)">&nbsp;Zavolat: ', datetime\format(datumDalsiAktivity, 'Europe/Amsterdam', 'DD.MM.YYYY HH:mm'), '&nbsp;</font></p>')
        );
        ​

        Comment

        • Jakub Grufik
          Senior Member
          • Aug 2022
          • 361

          #5
          Hi lazovic,

          thanks a lot for the help.

          Unfortunately, not much has changed. I used your syntax which is basically the same as mine but optimized and more logical.

          Now the workflow targets the first 3 records in the target report, again twice in a row as you can see in the Log (screen1).

          There are approx 5500 leads to be targeted but I cannot make it work for some reason.

          I have almost the same workflow for opportunities and everything is working fine there.

          Here is the code I use in the opportunities workflow which works fine:
          Code:
          ifThen(datetime\now() > datumDalsiAktivity && stage != 'Closed Lost', upozorneniPrilezitost = '<p><font color="#000000" face="Verdana" style="background-color: rgb(231, 99, 99);">&nbsp;Po termínu&nbsp;</font></p>')
          The only difference is that I divided the code into 5 single actions instead of a big one.(screen2)
          The workflow for opportunities targets 2500 records and works perfectly fine so the volume should not be causing problems with the "Lead workflow".

          Any idea what could be wrong?
          Thanks a lot for your time and help!
          Attached Files

          Comment

          • Jakub Grufik
            Senior Member
            • Aug 2022
            • 361

            #6
            I tried to divide the action into 2 separate actions, but it still targets only 3 records twice in a row.
            Attached Files

            Comment

            • lazovic
              Super Moderator
              • Jan 2022
              • 809

              #7
              Jakub Grufik,

              This action lacked condition (datumDalsiAktivity != NULL), so Workflow did not work correctly. Please try these formulas:

              Code:
              ifThen(
              datumDalsiAktivity != NULL && datumDalsiAktivity < datetime\now(),
              upozorneniLeadu = string\concatenate('<p><font color="#000000" face="Verdana" style="background-color: rgb(240, 71, 71)">&nbsp;Zavolat: ', datetime\format(datumDalsiAktivity, 'Europe/Amsterdam', 'DD.MM.YYYY HH:mm'), '&nbsp;</font></p>')
              );
              
              ifThen(
              datumDalsiAktivity != NULL && datetime\today() == datetime\format(datumDalsiAktivity, 'Europe/Amsterdam', 'YYYY-MM-DD'),
              upozorneniLeadu = string\concatenate('<p><font color="#000000" face="Verdana" style="background-color: rgb(255, 165, 0)">&nbsp;Zavolat: ', datetime\format(datumDalsiAktivity, 'Europe/Amsterdam', 'DD.MM.YYYY HH:mm'), '&nbsp;</font></p>')
              );

              Comment

              • Jakub Grufik
                Senior Member
                • Aug 2022
                • 361

                #8
                lazovic holy s man(sorry for that).

                It actually works now.

                Thanks a lot! Maybe I am just stupid but I still do not understand how this condition could make it work. It was behaving pretty weird before as it was targeting the first 3 records twice in a row for no obvious reason.

                I would not come up with this solution on my own for sure.
                From now when anything will not work as expected I will make sure that there is a condition making sure we are not working with an empty field.

                I think the reason why it was targeting just 3 records twice in a row will stay a mystery.

                Thanks a lot a thousand times! You saved my day.
                Wish you a great rest of the day!

                Comment

                Working...