Workflow/BPMN: Scheduled Trigger (Formula Field Support)

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • rabii
    Active Community Member
    • Jun 2016
    • 1303

    #1

    Workflow/BPMN: Scheduled Trigger (Formula Field Support)

    Lately come across a use case where i couldn't build a report for a scheduled workflow due to report requirements as needed to pull data of an entity (X) which the target entity and needed to get only the X records that have a certain status and linked to one account where no other x records exist with other status and created after previous condition. tried complex expression. So in order to get those records it would be easy to do so using formula. Wonder if it is technically possible to use formula on scheduled trigger as another options rather than having only reports. formula field should returns collection of ids to be run by the workflow/bpmn.

    This would help a lot to build complex formula to get records and pass them to workflow.

    Thanks
    Rabii
    Here to help :)
  • lazovic
    Super Moderator
    • Jan 2022
    • 1070

    #2
    Hi rabii,

    Please tell me if I understand correctly that you need to find a certain number of records related to some entity (target entity) and perform certain manipulations with these records?

    Comment


    • rabii
      rabii commented
      Editing a comment
      @lazovic

      Any news on this ?
  • rabii
    Active Community Member
    • Jun 2016
    • 1303

    #3
    Hey lazovic

    Thanks for your intervention.

    I need to find a collection of the target entity based on certain conditions (Select only records that met a condition). Here is my need, i have an entity called (Visit) which is linked to account through a one to many (one account has many visits). the visit entity has visitPeriod field (Date) and a status field (Planned - In Progress - No Resources - Completed). I need a collection of visits that meet the conditions below:

    - visit period (before June 2022)
    - status = 'No Resources'
    - should be last record on related account - meaning if there are any other visit with visit period > june 2022 and status != 'No Resources' then this should not be added to the collection.

    I hope this make sense.

    I have tried using complex expression but not found proper method to pull the data. Only way to meet the conditions is to use record/exist

    PHP Code:
    !record\exists('Visit''accountId='accountId'createdAt>'createdAt'visitPeriod>''2022-06-01''status!=', list('No Resources')) 

    Hence way i think having a formula field to find records and returns their Ids would help in such situation.
    Rabii
    Here to help :)

    Comment

    • lazovic
      Super Moderator
      • Jan 2022
      • 1070

      #4
      rabii,

      You can try to use the record\findRelatedMany() function to get visit IDs. Something like this:
      Code:
      $visitsIds = record\findRelatedMany('Account', accountId, 'visits', 100000, 'createdAt', 'desc', 'createdAt>', createdAt, 'visitPeriod>', '2022-06-01', 'status!=', 'No Resources');

      Comment


      • rabii
        rabii commented
        Editing a comment
        But this is the whole point of this feature request. the Scheduled Trigger doesn't support formula field. it only work with reports and reports doesn't support formula too. i hope this formula field could be added so that instead of building report that return ids for the bpmn/workflow to process, we could leverage the formula field to return a collection of ids that would be passed to the workflow to process.

        I would appreciate if you could share this with the team.

        There is no way to achieve this currently.
    Working...