Workflows and Relationship Creation Question

Hey all, Saw there were a couple of other similar topics, but exactly my issue.

I have a custom module “evaluations” that is like a report card for students (students=contacts renamed)

When I create an evaluation there is a relationship to the contact, works great.

I have a workflow when the evaluation is marked “complete” it sends an email to the contact and relates a task for the teacher (it does both on save).

If the evaluation exists, then changing to complete works no problem and the workflow runs on save properly.

HOWEVER, if I create a new Evaluation with status “complete” neither workflow runs properly. The task is not related the contact and no email is sent to the contact.

My guess is, the relationship isn’t saved yet when the workflow runs on save. If I run the same workflows in the scheduler (ie: not on save) they both work.

Is there some way to delay an on save action?? Like 1 minute or something that would ensure the relationship is created and the record is saved before the workflow runs and goes looking for the contact relationship? Or could this be a bug in the order things run on save?


this was discussed yesterday here

I suggest some workarounds.

Thanks @pgr I did read that one, it seemed to be more focused on duplication of records rather than creation of records. However, I think the issue is the same. You can’t relate a workflow action on save for new records because the relationship hasn’t been created yet. I would second the need for a “after save” workflow trigger.

It seems to be about duplication, but it isn’t (I was a bit mistaken for a few posts there). Duplication is just a way of testing creation-when-a-relationship-is-already-there.

I also explain why it’s really not possible to have that “after save” workflow, see my post there just now (which basically reiterates what I had written earlier).

It’s an interesting post and an interesting request, but I am afraid it’s really a matter of working around this.

1 Like

Thanks @pgr, in case anyone else is struggling, the workaround that I did was to create the workflow to run in the scheduler for any modified records to check that they were “complete” and then to create the task with the relationship to the contact. This works because it only runs once per record and when it runs in the scheduler, the relationship has already been created on previously saved records. It works, it would just be more elegant if it was possible to work this into an “on save” trigger. :slight_smile:

1 Like