Workflow when Cild add / delete / update I h...

(Fabian Weller) #1

Workflow when Cild add / delete / update

I have a parent ORDERS table and a child ITEMS table. I created a Workflow that fires, when the all items are added to the order. Like in this App:

Now I want to fire the Workflow again, when there is an add / delete / update in the items of that order.

How can I do this?

(Philip Garrett) #2


You can define an event triggered workflow rule that is invoked when a record is added, updated, or deleted to the Child table.

In that rule’s workflow template, you can retrieve the Parent record using the “Parent” Ref field that is contained in the added, updated, or deleted Child record.

Once you have the Parent record, you can display its contents.

You can also display all of its Child records using a expression and an embedded workflow template.

(Fabian Weller) #3

@Philip_Garrett_Appsh Thank you very much. Is there a Sample for that?

(Philip Garrett) #4


Not exactly, but look at topic “OrderTemplate in Table Format” in this article - Email Templates

When the Order record is updated it displays the Customer record, followed by a single Order record, followed by all of embedded Order Detail records for that one Order.

That sample workflow template shows how to get the Customer (parent) record from the updated Order (child) record and display the fields of the Customer record.

The sample only display the single updated Order record.

Instead of displaying that single Order record, you would need to write a <> expression to retrieve the list of all child Order records belonging to the Customer record. The <> expression could do this using the Reverse ref in the Customer record because that field contains the list of child Order records.

The <> expression would be followed by the embedded template that displays each to the child Order records.

Email Templates

(Fabian Weller) #5

@Philip_Garrett_Appsh Thank you very much Phil. So I will need 2 Workflows? 1 when the parent is created or updated, and 1 when something happens with the children. Because when creating an order with 10 items, I want to recieve only 1 E-Mail and not 10 :slight_smile: So when creating an order, I use the Parent Workflow, and when adding a child later, I use the Child Workflow. For each Workflow I need a seperate Template, because formulas are different. Am I right?

(Philip Garrett) #6


See topic “Sending Email After Adding a Parent Record and All of Its Children” in - Workflow


(Fabian Weller) #7

@Philip_Garrett_Appsh Thank you. I already did this. However I think I need 2 Workflow rules. One when a new Order is created and one when afterwards a child is added/updated/deleted. If we could do someting like [_THISROW_BEFORE].[Related Childs] <> [_THISROW_AFTER].[Related Childs] then the first workflow would be enough. But I think we cannot do the thisrow before / after with VC?