Announcement

Collapse
No announcement yet.

Creating a scheduled workflow

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

  • Creating a scheduled workflow

    I am having trouble creating a scheduled workflow. It is getting confusing especially with the report thing.

    I have an Entity called Membership Fees connected to Entity Contacts (labeled as Members) by Many -to - One. I am trying to create a workflow that creates a fee record for every Member (Contact) at the start of every year.
    The created Fee record has 2 essential fields 'Payment Status' set to 'Not Paid' by default and 'Fee' (name): Member's Name - Year. (See Image below)

    Click image for larger version  Name:	notPaid.png Views:	0 Size:	21.0 KB ID:	77242

    For example I have 203 Contacts, on January 1, 2022 I want to create 203 new Membership Fee records. The report is basically the list of Members (Contacts)

    Workflow & Report Below:

    Click image for larger version  Name:	schduled workflow.png Views:	0 Size:	36.9 KB ID:	77243Click image for larger version  Name:	report.png Views:	0 Size:	23.4 KB ID:	77244

    I really appreciate any help in how to achieve this. Thanks
    Last edited by JosNas; 12-06-2021, 03:16 PM.

  • #2
    Hi

    I think everything you have done is correct but you just missed one piece on the workflow, instead of create record, you can use Create Related Record and choose Membership Fees and then set up the field as you wish. see attached screenshot.

    I hope this helps

    Cheers
    Attached Files

    Comment


    • #3
      rabii I appreciate it! However I cannot see Membership Fees from the list in 'Link' in Create Related Record.

      Click image for larger version

Name:	Screenshot (5).png
Views:	335
Size:	60.9 KB
ID:	77268

      Comment


      • JosNas
        JosNas commented
        Editing a comment
        I'm wondering in the 'Scheduled' trigger what is the difference between the Target Entity, Target Report, and 'Link' when you select 'Create Related Record'. It is too confusing and seems overlapping

    • #4
      Hi JosNas,

      Hope this thread will help shed light:
      https://docs.espocrm.com/administrat...ows/#scheduled

      In your case, you have to create a Workflow for the "Members" target entity with Create Record action.
      Then select the "Membership Fee" entity, needed fields, and Link with target entity.

      Ex:
      Click image for larger version  Name:	2021-12-07_12-12.png Views:	0 Size:	31.2 KB ID:	77284Click image for larger version  Name:	image_6814.png Views:	3 Size:	18.8 KB ID:	77283
      Last edited by Vadym; 12-07-2021, 11:01 AM.

      Comment


      • #5
        Thanks Vadym it partially works but when I add the statement marked yellow as shown below, it is not executing.

        Click image for larger version  Name:	Capture.png Views:	0 Size:	35.1 KB ID:	77287

        Else When I remove that formula statement the records are being successfully created but the name is not having the requested format:
        (Contact's First Name Contact's Last Name - Year)

        Ex:
        Click image for larger version  Name:	Capture.png Views:	0 Size:	31.4 KB ID:	77288
        Last edited by JosNas; 12-07-2021, 01:02 PM.

        Comment


        • rabii
          rabii commented
          Editing a comment
          Hi JosNas

          I can see that you have changed the workflow entity to members which means if you choose Create Related Record you will be able to select Membership Fees. Please note that you can't use both Formula and fields at the same time when creating a record, i suggest you do it all through Formula, see code below:

          Code:
          // set payment status
          paymentStatus = "Not Paid";
          // Set year as current year
          year = datetime\year(datetime\today());
          // set up name 
          name = string\concatenate(contact.firstName, ' ', contact.lastName, year);
          let me know if that worked for you.

          Cheers

      • #6
        Selecting the full name ('name' field) of the Member would solve my issue I guess. However I am only being given the options of choosing First Name or Last Name. (image below)

        Click image for larger version

Name:	Screenshot (12)_LI.jpg
Views:	364
Size:	55.2 KB
ID:	77315


        Can I use a formula in the same Action of the Workflow to concatenate 'First Name' and 'Last Name' and assign them to 'name' field of Membership Fee Entity? (image below)
        Click image for larger version

Name:	Screenshot (13)_LI.jpg
Views:	319
Size:	61.2 KB
ID:	77316
        Last edited by JosNas; 12-08-2021, 11:52 AM.

        Comment

        Working...
        X