I have create a form on a Customer Community where users submit records and in turn a time-based workflow is created to change the value of a field on that new record at a certain time. In turn, a changing value on that field triggers a post to Chatter.

The problem I'm having is the running user for that time-based workflow is the Customer Community user, who doesn't have access to Chatter. So when it gets to the step of looking up the appropriate Chatter Group to post in, the group is not found since the Customer Community user doesn't have access.

The solution currently works like so:

  1. Time-based Workflow trigger field update
  2. Process Builder listens for field update and calls Visual Flow
  3. Visual Flow queries for Chatter Group (CollaborationGroup) and posts Chatter message.

It's my understanding that Process Builder runs in System Mode and if it calls a Visual Flow, it too runs in System Mode. However, this is not happening in my case. By checking {!$User.Id} in step 3 I see the Community user. It appears triggering the field update in step 1 has caused the Process Builder to run in User Mode, or at least instruct the Visual Flow to run in User Mode.

Is there a way I can cause the Visual Flow to executed as a user I choose, and not the Customer Community user?

  • 2
    Moving the trigger behavior to say an hourly scheduled job would let you control whos executing the code & preform actions out of context of those users. – battery.cord Jul 31 '18 at 17:02
  • 1
    Its possible that using the ConnectAPIHelper might just help solve the problem for you. I know you can do a lot with it, whether it can be used to solve your particular problem, I'm not entirely certain. – crmprogdev Jul 31 '18 at 17:48
  • Time based workflow run as the workflow user configured in the Org.Are you sure it runs as the community user? – RedDevil Jul 31 '18 at 17:53
  • 1
    It's my understanding that time-based workflow runs as the user who triggered the workflow unless that user is inactive, @RedDevil. The workflow user configured in the org is admin and has access to the Chatter Groups. – Swisher Sweet Jul 31 '18 at 18:34
  • 2
    Yeah Schedulable is by far the most obvious and straightforward approach here. You could have the workflow insert a shadow object and then have the scheduled job convert them if you prefer. – Adrian Larson Jul 31 '18 at 21:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.