I have a question concerning the Social Customer Service- particularly the paying version -> Social Studio. This version allow to edit the apex on the Salesforce setup (Setup - Social Media-Inbound Settings). My question is: Is there an apex class that allow us to create cases automatically based on keyword that have been detected on social network ??

If yes, do you know where can I find a code library as I'm a not developer.

2 Answers 2


The default code for Social Customer Service is available on the Salesforce Help site here. There is also a test class provided for it.

This will create social personas if they do not already exist, create social post records and add or update cases as new social posts or responses are received.

Guidance on modifying the default class is here.

This cannot be used with the starter pack

You can’t modify the default Apex class if you are using the Starter Pack. The free Starter Pack lets you simply connect up to two social accounts and Salesforce handles the rest of the details, like a Social Studio account.

If you alter the default Apex class, be sure to select your new Apex class on the setup page, where you can also see Apex processing errors. From Setup, enter Social Media in the Quick Find box, then select Settings. An email is sent to the administrator when there are errors and, in most circumstances, the data is saved and can be reprocessed. If too many errors are waiting for reprocessing, the Salesforce Social Hub rules are automatically paused to ensure social content is not missed.


Customizing the default Apex class for Social Customer Service gives you full control of how and when a case should be created. For instance, you can gather those posts that are retweets, avoid creating cases for them and just store them as Social Posts. In your case, you should whether work with Social Hub to identify those posts that meet your needs (specific keyword) and send those posts automatically to Service Cloud with the "create case" checkbox ticked.

Even with the standard class, this should allow you to create cases (or not) depending on the source.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .