conditions of the workflow

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • peterberlin
    Active Community Member
    • Mar 2015
    • 1004

    conditions of the workflow

    Hello,
    I would like to start a workflow when a certain dataset does not exist.
    Therefore, I have entered this script in the conditions of the workflow.


    'false' != record\exists(Anlage, anlagesNames=, anlagennummer);

    But the syntax is wrong.
    Does anyone have an idea?

    peter​
  • item
    Active Community Member
    • Mar 2017
    • 1476

    #2
    Hi,
    record\exists('Lead', 'emailAddress=', fromAddress)

    return true or false. You must quote too.




    so if understand :
    ifThen(
    record\exists('Anlage', 'anlagesNames=', anlagennummer) ,
    'blabla')
    Last edited by item; 03-21-2023, 09:02 PM.
    If you could give the project a star on GitHub. EspoCrm believe our work truly deserves more recognition. Thanks.​

    Comment

    • peterberlin
      Active Community Member
      • Mar 2015
      • 1004

      #3
      Hello Item,

      thank you for pointing out the quote.
      However, my task is far more complicated than I thought at the beginning.
      The workflow is for entity B.
      I have two entities (A and B). In the workflow, I need to test whether a record exists in entity A. However, the search value is in entity B, i.e. the entity that the workflow accesses.

      I have now tried this formula without success:
      record\exists('name of entity A', 'entity\attribute('A.fieldname')=', entity\attribute('B.fieldname')) != true;

      (This code is in the workflow conditions, not in the workflow actions).

      Comment

      • item
        Active Community Member
        • Mar 2017
        • 1476

        #4
        Hi,
        i respond with iPad, not easy write :

        record\exists('name of entity A', 'fieldNameA=', fieldNameB ) != true

        1 param : entityName quoted : sample ‘Lead’
        2 param : fieldName of entity A quoted : sample ‘name=‘
        3 param : as it’s workflow on entity B, fieldNameB is available directly : sample : name
        If you could give the project a star on GitHub. EspoCrm believe our work truly deserves more recognition. Thanks.​

        Comment


        • peterberlin
          peterberlin commented
          Editing a comment
          OK
          Thank you.
          I'll give it a try,
      • rabii
        Active Community Member
        • Jun 2016
        • 1250

        #5
        Hey peterberlin

        Try this, let us suppose we have entity Account and field Name and entity Contact and field is accountName (workflow is based on Contact) :
        PHP Code:
        record\exists('Account', 'name!=', entity\attribute('accountName')) 
        
        The reason is that the condition is waiting for a truthy statement i guess and not false statement return. i could be wrong but jut give it a try.

        i have tried this record\exists('name of entity A', 'entity\attribute('A.fieldname')=', entity\attribute('B.fieldname')) != false in the paste and kind didn't work all the time.
        Rabii
        Web Dev

        Comment


        • peterberlin
          peterberlin commented
          Editing a comment
          Thank you very much.
          I will test it
      Working...