In our community, we want to post automated welcome messages in Chatter. Does anyone know if it is possible to use a flow and process builder to post to Chatter on behalf of another user, like say a community manager. I know that the ConnectApi does not allow this, but you can get around this in plain apex. I'm also curious if there is a declarative way around this as well.
-
If you can do it in plain Apex, you might want to think about an invocable that can be called from a flow.– crmprogdevCommented Dec 9, 2016 at 3:56
-
Invocable is a good second option, thanks for mentioning. I'm still curious about doing this entirely declaratively.– greenstorkCommented Dec 9, 2016 at 17:40
-
Not sure if I have seen an option for a Process Builder to run as a specified user, it normally runs as a system user and flow runs as the calling user. Think this is worth trying to build a poc for.– Dave HummCommented Dec 10, 2016 at 2:58
1 Answer
You can set CreatedById
on FeedItem
in visual workflow.
This will set who the post is from.
Couldnt figure out a way to do it in process builder, as the 'post to chatter' functionality doesnt let you set this, and 'feedItem' is not listed in the 'create a record' option
Screenshot of my assignment element and the test flow below
Assignment element to construct feedItem sObject variable
Flow
This flow successfully created a post on the ParentId user's feed, from the User set as CreatedById
Came across another sfse post that highlights one limitation of this approach - you can't at mention anyone or use topics. Also not sure about any community specific considerations.
To at mention you need to use the standard post to chatter element, but it doesn't appear like you can set created by id going that route.
So if you need at mention capabilities along w created by id, a custom Apex plugin likely is needed.
-
1The message body looks like something we'd all like to see. Commented Jan 8, 2017 at 22:09