Announcement

Collapse
No announcement yet.

Workflow is not working - did i used it the right way?

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

  • Workflow is not working - did i used it the right way?

    Hi,
    i created an entity. Th data must be checked by serveral Persons so i created an workflow.
    i made rules to change fields based on other fields. I did all Formulas in one workflow.
    Here are the Rules
    Code:
    ifThen(
        intstatus == new,
        cnsum = entity\sumRelated('rgposs', 'amountcorrection',)
        );
    
    ifThen(
        status == 'check' && intstatus == new,
        cncreator = string\concatenate(createdBy.firstName, " ",createdBy.lastName);intstatus = 'check';cncreatordatetime = datetime\now();cncreatoruid = modifiedBy.userName;message = 'Neue Anfrage - Bitte prüfen ob CN erstellt werden muss'
        );
    
    
    ifThen(
        status == 'accepted' && intstatus == 'check',
        cnrequestor = string\concatenate(modifiedBy.firstName, " ",modifiedBy.lastName);intstatus = 'accepted';cnrequestordatetime = datetime\now();cnrequestoruid = modifiedBy.userName;message = 'Korrektur notwendig - please certifie'
        );
    
    
    ifThen(
        status == 'certified' && intstatus == 'accepted' && cnrequestoruid == modifiedBy.userName,
        cncertifier = string\concatenate(modifiedBy.firstName, " ",modifiedBy.lastName);intstatus = 'failed';status = 'failed';message = 'Fehler - Anforderer ist gleich Zertifizierer';cncertifierdatetime = datetime\now();cncertifieruid = modifiedBy.userName
        );
    It is OK putting several Formulas in one Workflow?
    Because nothing happend.


  • #2
    Hi,
    firstly check a log file. If the formula has some error it should tell you that. Also, please check this:
    1. Why new in intstatus == new, without quotes (ex. intstatus == 'new')?
    2. Remove last coma in cnsum = entity\sumRelated('rgposs', 'amountcorrection',).

    Comment


    • #3
      Cool, i missed the qutes. The first two ifthen are working.

      But if i reload the page all chages are gone?

      The Logfile is: data/logs right?
      I put the loglevel to Debug.

      Regards Jens

      Comment


      • #4
        Hi Maximus,

        Honestly, the documentation on the usage of the Advance Pack with regards to Wokflows, Processes and Flowcharts is really confusing and disjoint. Like JayBee4pl here, i am having some real headache in trying to figure out what to do and where to start. I am an experience Business Process engineer with extensive experience in tools like Bizagi, Joget etc. With all this experience i am still confused how it all works in the Advance Pack. I trying the process below and it does not appear to be working. I have checked the log and there is nothing.

        All i am trying to do is to go through the all the prescription records which have expired and update the status to "Expired". The flow chart only involves only 3 simple activities. The following are the screen caps of what i did:

        Attached Files

        Comment


        • #5
          Hi murugappan,
          I think your problem is in the report condition. Condition: 'Expiry Date is older then 1 day' means that today and yesterday will not be in the list. You have to remove this, condition and add the 2 new conditions:
          1. Expiry date = today;
          2. Expiry date = past.
          Also, you don't need to execute this flow every minute. After you fix it, I suggest you to set schedule to run once a day (e.g. 0 0 * * *).

          Comment


          • #6
            Hi Maximus,



            Thank you for advice. I change the condition to "past". The one for "today" is not required because the expiry date matching today does render the prescription as expired. It expires only on the next day. After making the changes, the report seems to be working fine but the target record status has not been updated to "expired" as defined (see attachments). Please help.

            Also, need some additional info to understand better:

            (1) Does "past' mean before today?
            (2) Which schedule job runs workflows?
            (3) How would we know if this workflow was executed?

            Your help on these will help me and others understand the workflow mechanism better. I also putting some effort to consolidate and document the Workflow and BPMN and publish it for you. Appreciate all the help from you to create examples and test them out (or is there one such document already?).
            Attached Files
            Last edited by murugappan; 03-18-2020, 01:58 AM.

            Comment


            • #7
              > The one for "today" is not required because the expiry date matching today does render the prescription as expired.
              I agree.

              > but the target record status has not been updated to "expired" as defined (see attachments).
              This is BPM. Open Administration -> Processes -> process to change the status and check whether all stages were passed with success https://github.com/espocrm/documenta...m.md#processes

              > Also, need some additional info to understand better:
              1. Yes.
              2. As far as I know, it is 'Workflow: runScheduledWorkflow' job. Its schedule depends on the schedule of the Workflow or BPM.
              3. Administration -> Processes -> process

              Comment


              • #8
                Hi Maximus,

                Thank you so much for the help. I found the bug in my definition. The reason it did not work is that the "target entity" was missing. I know i defined that but somehow it just went missing. The log helped me identify this. I getting a better feel of the BPM and Workflows.

                Great job. Thanks again.

                Comment

                Working...
                X