Hi,

I have a CCK type I defined that is sort of like a purchase request. It has 2 fields of interest, "assigned to" which is a User Reference, and "status" which is a pull-down with a few text items in it ("Open", "NeedsApproval", "Approved", "OnOrder"....).

When someone creates one of these "assigned to" gets a default user in the system. When he changes "status" to "NeedsApproval" and changes "assigned to" to someone else, email should be sent to the user that needs to approve.

Seems to me I need to know the previous value of something (ie., "status" changed between 2 states, "assigned to" changed from one user to another) but I don't see how to do this. The only event that's close is "content is going to be saved" but I can't see how I can look at the previous and current values of the fields I need to look at. Is there some syntax for that?

This seems to me the basic use of a workflow module, being able to recognize a state change and act on it. So I must be missing something basic. Or, do I really have to code something for this?

Thanks!

Comments

hsfdrupal’s picture

Oh, duh - think I got most of it with a little experimentation. I see the "Unchanged" replacement patterns. I thought that meant fields the user didn't touch. . . :-)

The one thing I can't figure out is how to get the email address of the new user in the "assigned to" field. It lists the uid, name, and link, but the email address is in the usernode. Any ideas how I can grab that and get it into the Recipient line of the email action?

fago’s picture

Title: Help understanding basics: cck field changes from one val to another » using users of user reference

Currently this isn't possible with workflow-ng - it's still on my todo list and will be possible soon. The clean way to do it, would be to have the references user available as argument.

For now, you could do it with a token integration, which adds the mail address of the referenced user.

hsfdrupal’s picture

>  For now, you could do it with a token integration, which adds the mail address of the referenced user.

Hm, I think I know what is involved, from reading other posts like:

   http://drupal.org/node/198122

But I think the chances of me getting this to work (correctly) any time soon are slim. Do you have any idea when you might get to that item on your todo list? It might be better for me to just wait.

Thanks!

hsfdrupal’s picture

> Do you have any idea when you might get to that item on your todo list? It might be better for me to just wait.

I guess no response means "No idea"?? :-)