check if current account has planned calls via Formula

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

    check if current account has planned calls via Formula

    Hey everyone,

    I am trying to check if the account has any planned calls through formula but not working, iam using call entity as target entity for a workflow to check if its parent company has any 'Planned' calls so if it is the case i want to complete all current activities but seems not working, this is the code i have used in formula :

    parentType = 'Company';

    !entity\countRelated('calls', 'Planned');

    This doesn't work

    can anyone help please, just want t understand how to use build in formula to check if an account has any planned calls or not.

    Many thanks
    Rabii
    Web Dev
  • Maximus
    Senior Member
    • Nov 2018
    • 2731

    #2
    Hi,
    the 'entity\countRelated' function returns a number of related records. I think you should try this one https://github.com/espocrm/documenta...d#recordexists.

    Comment

    • rabii
      Active Community Member
      • Jun 2016
      • 1250

      #3
      Hey Maximus ,

      Thanks for your reply, i have tried record\count() but didn't work but this will just count records of call with specified filter. What i am trying to achieve is to check if an account has any Planned calls so if this returns true then i want the workflow to close all active calls on this current account.

      I tried this but didn't work too : ! entity\countRelated('Calls', 'Planned') . ALSO tried it this way entity\countRelated('Calls', 'Planned') = 0;

      I am not sure what is the right syntax to detect if an account has any Planned calls or activities like task.

      I hope someone could help, it is very important for me

      many thanks
      Rabii
      Rabii
      Web Dev

      Comment

      • Maximus
        Senior Member
        • Nov 2018
        • 2731

        #4
        Try to make a scheduled workflow. Make a report to filtarte your calls and link it to your workflow. Cron will fire this workflow, workflow will run the report and make the action to the records that will be finded by the report.

        Comment

        Working...