I have a MySQL table called Product which has columns id, orderDate and received

I have a MySQL table called Product which has columns id, orderDate and receivedDate (plus others). OrderDate gets set within the main flow, which then needs to pause until the product has been received - ie receivedDate is not null.

The receivedDate gets set by a Related Action.

How can I get my main flow to detect that receivedDate has been set, and then continue?

I tried creating a rule called 'IsProductReceived' that contains a queryEntity to return true if the receivedDate is not null, otherwise returns false. This works as expected when I test it in isolation.

I put this rule into the expression of a Rule Event. When I execute the Rule Event, I get an error "ERROR:EVAL:@reason=index".

Am I attempting to do this in the right way and have some error in my rule, or am I using the wrong method to do this?

OriginalPostID-147702

OriginalPostID-147702

  Discussion posts and replies are publicly visible

  • @paule Hi, here goes my answers for your questions and please do let me know if you have any follow up questions:

    Am I attempting to do this in the right way and have some error in my rule, or am I using the wrong method to do this?:

    To the best of my knowledge, a rule event can be used to monitor global constants and process variables. Documentation at https://forum.appian.com/suite/help/7.9/Rule_Event.html under 'Configuring a Rule Event' says that 'With an expression, you can use a Rule Event to monitor global constants and process variables. Each time a global constant or process variable is changed, the rule is reevaluated.'


    How can I get my main flow to detect that receivedDate has been set, and then continue?:

    There are several ways of doing and one of them is as follows:

    Main flow:
    Step - 1: Create a boolean variable called 'isProductReceived' in the process and configure it to false initially. Use the same variable in the rule event and trigger the event only when the 'isProductReceived' is set to true. (Infact you could test for a null value on the Products.ReceivedDate variable itself instead of creating an boolean variable)
    Step - 2: Configure a receive message event in the process and configure it in such a way that the receive message event sets the isProductReceived to true, and queries the Product variable (in order to reflect the latest value of receivedDate) in the subsequent node.

    Related action:
    Step - 1: Upon completion of setting the receivedDate and the relavant database updates in the related action, configure a send message event and use it in sending the message to the main flow.
  • Additionally, you have to store process instance id to send the message to the intended process instance. You can also think over using Set PV smart service to set the value of process variable ‘isProductReceived’ to true. Set pv smart service can be called when related action is submitted and received date value is written to database.
  • @paule As amitl said, you could persist the process id in the database. If you don't want to make any additional changes in the existing database, you could find out the process id you want to target by creating a report and thereby querying the process analytics by using either of the functions - a!queryProcessAnalytics (if you are on 7.8 and 7.8)/ getportalreportdatasubset (Below 7.8), or Execute portal report smart service.
  • 0
    Certified Lead Developer
    Is the call to your isProductReceived() function using keyword parameters? i.e. isProductReceived(id: pv!id) vs isProductReceived(pv!id)
  • thanks, all, for taking the time to comment.

    amitl and sikhivahans - I am making progress on the lines you suggest.

    conorc - without keyword parameters