function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Kumar_ShahKumar_Shah 

Error while creating a chatter post using Process Builder

Hello,

As I understand, Process Builder runs under the system mode and if the running user doesn't have permission, the user still able to perform the operation due to system mode. I tried to create a chatter post on a case object using Process Builder, by running as a user who has implicit permission on the case. When I looked at the log, it still runs under the user mode (I can see as Current User) and got the following error while creating a chatter post

Error Occurred: You don't have permission to do this. 
________________________________________
________________________________________
Salesforce Error ID: 157378386-59592 (1177104658)

Thanks,
ShirishaShirisha (Salesforce Developers) 
Hi Kumar,

Greetings!

If you are trying to access/update the specific field on which you do not have access then also you can see the same error.

So,I would suggest you to capture the debug logs and check,when you are getting this error to confirm the field.

Kindly mark it as best answer if it helps so that it can help others in the future.

Warm Regards,
Shirisha Pathuri
Kumar_ShahKumar_Shah
Thanks for the reply. The triggering user doesn't have permission to use Chatter but if the Process Builder runs under System Mode that it should have permission to all object including chatter.  I am getting an email whenever the process builder fails and it shows "Error Occurred: You don't have permission to do this." error.  Thanks,
MoggyMoggy

you will need to pull / monitor the logs, you will find out that , trigger , worklfow and process builder are running in user context.

If you like to have a run in system context you need to use a flow or a platform event

goravsethgoravseth
I have run into this a few times, and did some more testing today.  Record triggered flows, processes, etc all should run in system mode and do run in system mode for many purposes, but not for post to chatter.  I've tested posting to private groups, objects without CRED, etc.

Using a platform event as an intermediary might work, but seems like overkill.

I believe if you insert a feed item, instead of using the post to chatter option, then flow/process will work - but you lose the ability to at mention people. Gonna test that now.

One could log a case for this, but i doubt it will get any traction.  
goravsethgoravseth
Confirmed - creating / inserting feed item works in system mode.  However as far as i know there is no way to at mention user/group or add topics when inserting feed item as object vs using the post to chatter action.