Menu
Welcome, Guest
Username: Password: Remember me

TOPIC: Workflows and Relationship Creation Question

Workflows and Relationship Creation Question 2 months 1 week ago #85765

  • pstevens
  • pstevens's Avatar
  • Offline
  • Elite Member
  • Posts: 201
  • Thank you received: 24
  • Karma: 4
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?
The administrator has disabled public write access.

Workflows and Relationship Creation Question 2 months 1 week ago #85777

  • pgr
  • pgr's Avatar
  • Offline
  • Administrator
  • Posts: 10664
  • Thank you received: 1603
  • Karma: 363
Hi

this was discussed yesterday here

suitecrm.com/suitecrm/forum/suitecrm-7-0...workflow-not-working

I suggest some workarounds.

My SuiteCRM In-depth blog.
Thank you for always stating your SuiteCRM version, checking your logs, reading the Docs, and searching before you ask!
The administrator has disabled public write access.

Workflows and Relationship Creation Question 2 months 1 week ago #85805

  • pstevens
  • pstevens's Avatar
  • Offline
  • Elite Member
  • Posts: 201
  • Thank you received: 24
  • Karma: 4
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.
The administrator has disabled public write access.

Workflows and Relationship Creation Question 2 months 1 week ago #85807

  • pgr
  • pgr's Avatar
  • Offline
  • Administrator
  • Posts: 10664
  • Thank you received: 1603
  • Karma: 363
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.

My SuiteCRM In-depth blog.
Thank you for always stating your SuiteCRM version, checking your logs, reading the Docs, and searching before you ask!
The administrator has disabled public write access.
The following user(s) said Thank You: pstevens

Workflows and Relationship Creation Question 2 months 1 week ago #85808

  • pstevens
  • pstevens's Avatar
  • Offline
  • Elite Member
  • Posts: 201
  • Thank you received: 24
  • Karma: 4
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. :)
The administrator has disabled public write access.
The following user(s) said Thank You: pgr
Time to create page: 0.058 seconds
Powered by Kunena Forum