4

I'm using Process Builder and Visual Workflow to sync a custom appointment object and its "Room" selection picklist with the public resource calendars we set up for our conference rooms. Here's how it works:

1) The flow checks the Event for any existing EventRelations which represent the public calendars for our conference rooms.

2) If it finds any it deletes them to clear the way for the new conference room assignment.

3) It then creates a new EventRelation for the conference room calendar that corresponds with the Room selected on my custom object.

The public calendars are supposed to throw an error if they are already booked and someone tries to schedule them for the same time. However here's the behavior I'm experiencing:

1) I create a new Event and try to assign it to Conference Room 3. Conference room 3 is already booked at that time but the flow creates the EventRelation anyway! (If I try to access the Event via the browser and edit it I get the expected error message telling me that the resource is scheduled)

2) I realize that the meeting room was already assigned to I try to change it from Conference Room 3 to Conference Room 1.

3) The flow fires, I don't get any errors and yet the event still shows Conference Room 3. It's like it gets stuck.

For the record I have shown that the flow successfully updates the conference room as expected as long as neither of the rooms are booked at that time. So there are 2 problems I see here:

1) The booked room should not have been allowed to be assigned in the first place.

2) Once added, I can't seem to use my flow to delete the offending room.

So what's my question? Why does the standard validation not fire when the EventRelation is created using flow? And why can't I delete an EventRelation which had a conflict? Thanks!

0

1 Answer 1

3

Since this runs from Process Builder, any validation rules you have for your Calendar will be ignored. Processes from Process Builder execute after validation rules, triggers and workflow. See Order of Execution in Apex Developer Guide and Process order for automation rules and Apex triggers.

You'll need to create your own validation of some sort in Process Builder that runs within your flow to recreate that feature or "test" before you try to save records that you're inserting. You're essentially creating the functionality of a trigger when you do this from Process Builder. If you want your validation rules to fire, the only way that might happen would be to create your flow using VisualForce as an Interview.

1
  • Great, thanks!! "Always check the Order of Operations first!" I should've known. Commented May 25, 2016 at 16:04

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .