You are viewing limited content. For full access, please sign in.

Question

Question

Can Workflow find the user name if the WF was started based on a field change?

asked on January 15, 2016

I'd like to have an "Approved By" field filled in by Workflow, based on who changed the status field to "Approved".  If the starting rule is activating the WF based on a field change, then it can't find the user, right?  Can WF be set to look at the Last Modified By field?  I can't seem to find a way to set that.

Thx, Connie Prendergast, Flagstaff County, AB Canada

0 0

Replies

replied on January 15, 2016

You should be able to use the Initiator token as that will show which user performed the change that triggerred workflow.

If the event is driven by a "Wait for Entry Change" command, there is also an "Event User" token on each wait activity that shows who satisified the wait conditions.

0 0
replied on January 15, 2016 Show version history

Thanks, John.  Okay, so after some testing using the Initiator token, I can confirm two things:

1) The field gets filled in with Admin as the "initiator" is the workflow itself in this case since the connection profile is set as admin.  Does that mean this document has to be part of a business process with a Wait for Entry Change setting in it?  Was hoping not to have to do this until I'm ready for the Accounts Payable process to go live.

2) The WF is also in a loop.  The WF is set to start upon "Entry Changed" with the change to be setting a field to Approved.  Once the status field is changed to Approved, the WF continues to try over and over again to set the "Approved By" field to the initiator. (I have to disable the starting rule to get it to stop.)

0 0
replied on January 15, 2016

Hi Connie,

1. Initiator will always show whichever user performed the action that started the workflow. This can include the user workflow is logged in as if the account performed the action. You do not need to have a wait for entry change condition to use the Initiator token.

2. Generally you will want to have an option to prevent loops. We always have workflow running as a WorkflowUser account and then we would add as part of the starting condition User Does not Equal WorkflowUser like below. This prevents loops from happening.

1 0
replied on January 15, 2016

Haha, right!  I do have the User is not Workflow in the starting rules, but I forgot to change the connection profile from Admin to Workflow when I built the WF!  :)  That will certainly take care of the looping!

As for the user name and the initiator, I still haven't found a solution for that.  I know I can do it in a BP, but haven't been able to get it to pull the user in this very basic WF.   It is filling in the field, but instead of the user name, it is adding the word True to the Approved-By field.

0 0
replied on January 15, 2016

Put a track tokens in there so we can see what the initiator token actually is. My guess is your account lookup just isn't working correctly. I know sometimes for windows accounts we have to strip off the domain with regex if you are querying active directory.

1 0
replied on January 15, 2016

It's working now!  I took out the Find User activity, so the only thing in the WF is the Assign Field Values activity and that is set with the "initiator" token for the Approved-By field.  And my test run worked!

Thanks, John!

0 0
You are not allowed to follow up in this post.

Sign in to reply to this post.