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
Dee Dee AaronDee Dee Aaron 

Trigger Help for FeedComment

Hi. I am hoping to use a trigger like the ones in this example thread. I think I can just use the same code from these threads, but I don't know what I need to modify so instead of applying to Case, it applies to my custom object.
https://developer.salesforce.com/forums/?id=906F0000000D8WtIAK
https://developer.salesforce.com/forums/?id=906F0000000fyASIAY (https://developer.salesforce.com/forums/?id=906F0000000fyASIAY" style="color:#0563c1; text-decoration:underline)


I have a custom object called “Sales Engineering Request” and there’s a chatter feed on this object.
I have a custom “status” field with a picklist and I want the value to be updated based on the last Feed Comment that was made.


Criteria:
If status is in “Pending Review" or "Awaiting Reply from Net Planning" or "Awaiting Reply from Sales”, then update based on the last commenter.
If the last person who commented is part of the Net Planning Department (User Profile ID: 00e3t000001PTFmFFO), update the status to: “Awaiting Reply from Sales”
If the last person who commented is NOT part of the Net Planning Department (Does NOT have User Profile ID: 00e3t000001PTFmFFO), update the status to: “Awaiting Reply from Net Planning”

Note: I was able to get this to work using a process builder for the feeditem, but the feedcomment is not available from Workflows, Process Builders, or Flows, so I believe a trigger is the best path.

Thank you for your help.
Best Answer chosen by Dee Dee Aaron
ShirishaShirisha (Salesforce Developers) 
Hi Aaron,

Greetings!

I would suggest you to initiate the trigger by replacing the Object and the field instead of the Case with the sample code given in the link:

https://developer.salesforce.com/forums/?id=906F0000000D8WtIAK

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

Warm Regards,
Shirisha Pathuri