Message Trigger

Processing Social25__Heroku_Message__c records

As soon as message arrive in the Salesforce environment Social25 has triggers that will be executed. These triggers will process the messages for you if this is enabled in the active Social25 config. Please refer to the Flow Chart for the message flow.

 

The entire flow is customisable since every Salesforce environment is different. This existing flow is applicable to most Salesforce environments that have a standard Sales for Service cloud implementation. For more information how to configure the standard trigger, go to:

https://gen25-jira.atlassian.net/wiki/spaces/SOC/pages/2864873541

Field Mapping

1. Lead

1 2 3 4 5 6 7 Lead( Heroku_Conversation_Id__c = Heroku_Message__c.Chat_Identifier__c, LastName = Heroku_Message__c.User_Full_Name__c, Phone = Heroku_Message__c.User_Phone_Number__c, LeadSource = Heroku_Message__c.Conversation_Medium__c, RecordTypeId = Social25_Config__c.Default_Lead_Recordtype__c )

2. Person Account

1 2 3 4 5 6 Account( FirstName = Heroku_Message__c.User_First_Name__c, LastName = Heroku_Message__c.User_Last_Name__c,//When User_Last_Name__c is empty, use User_Full_Name__c Phone = Heroku_Message__c.User_Phone_Number__c, RecordTypeId = Social25_Config__c.Default_Account_Recordtype__c )

3. Business Account

1 2 3 4 Account( Name = Social25_Config__c.Default_Account_Name__c, RecordTypeId = Social25_Config__c.Default_Account_Recordtype__c )

4. Contact

1 2 3 4 5 6 7 Contact( FirstName = Heroku_Message__c.User_First_Name__c, LastName = Heroku_Message__c.User_Last_Name__c,//When User_Last_Name__c is empty, use User_Full_Name__c Phone = Heroku_Message__c.User_Phone_Number__c, AccountId = {Id of Default or Created Account}, RecordTypeId = Social25_Config__c.Default_Contact_Recordtype__c )

5. Social Post

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 SocialPost( Name = 'Message to/from' + Heroku_Message__c.User_Full_Name__c, ExternalPostId = Heroku_Message__c.Identifier__c, IsOutbound = Heroku_Message__c.Outbound__c, Content = Heroku_Message__c.Text__c, Provider = Heroku_Message__c.Conversation_Medium__c, Posted = Heroku_Message__c.Timestamp__c, Headline = Heroku_Message__c.Text__c,//First 255 characters AttachmentUrl = Heroku_Message__c.Content_Url__c, ParentId = {Id of the found/created Case}, //Only when existing Opportunity__c = {Id of the found/created Opportunity}, //Only when existing PersonaId = {Id of the found/created Social Persona}, Conversation__c = {Id of the found/created Conversation__c}, WhoId = {Id of the Parent from the Social Persona}, //Only when the parent is not a Social Post OwnerId = Heroku_Message__c.Agent_Identifier__c //Only for Outbound messages )

6. Social Persona

1 2 3 4 5 6 SocialPersona( Name = Heroku_Message__c.User_Full_Name__c, //When User_Full_Name__c is empty, use User_Last_Name__c Provider = Heroku_Message__c.Conversation_Medium__c, ExternalId = Heroku_Message__c.Heroku_User_Identifier__c, ParentId = {Id of the found New Person Type} //Can be Account/Contact/Lead/SocialPost )

7. Conversation

1 2 3 4 5 6 7 8 Conversation__c( Heroku_Conversation_Id__c = Heroku_Message__c.Chat_Identifier__c, Channel__c = Heroku_Message__c.Conversation_Medium__c, Account__c = {Id of the found/created Account},//Only when existing Contact__c = {Id of the found/created Contact},//Only when existing, Lead__c = {Id of the found/created Lead},//Only when existing, Social_Persona__c = {Id of the found/created Social Persona}, )

8. Case

1 2 3 4 5 6 7 8 9 10 11 12 13 14 Case( Heroku_Conversation_Id__c = Heroku_Message__c.Chat_Identifier__c, Platform_Identifier__c = Heroku_Message__c.Platform_Identifier__c, Origin = Heroku_Message__c.Conversation_Medium__c, Opportunity__c = {Id of found Opportunity},//Only when existing Lead__c = {Id of found Lead},//Only when existing RecordTypeId = Social25_Config__c.Default_Case_Recordtype__c, SourceId = {When parent of Social Persona is Social Post, Id of that parent}, Subject = Heroku_Message__c.Text__c,//Only first 255 characters Description = Heroku_Message__c.Text__c, AccountId = {When parent of Social Persona is Account, Id of that parent},//Or AccountId of Contact when Parent is Contact ContactId = {When parent of Social Persona is Contact, Id of that parent},//Or PersonContactId of Account when Parent is Account AssignmentRuleId = {Heroku_Message__c.Use_Case_Assignment_Rules__c is True, use Id of Active AssignmentRule} )

9. Opportunity

1 2 3 4 5 6 7 8 9 10 Opportunity( StageName = 'Prospecting', Name = Heroku_Message__c.User_Full_Name__c, Heroku_Conversation_Id__c = Heroku_Message__c.Chat_Identifier__c, CloseDate = {Date.today() + Social25_Config__c.Opportunity_Duration_In_Days__c},//When Opportunity_Duration_In_Days__c empty, then Date.today() AccountId = {When parent of Social Persona is Account, Id of that parent},//Or AccountId of Contact when Parent is Contact Opportunity_Source__c = Heroku_Message__c.Conversation_Medium__c, RecordTypeId = Social25_Config__c.Default_Opportunity_Recordtype__c, Source_Post__c = {When parent of Social Persona is Social Post, Id of that parent} )

10. Heroku Message

1 2 3 4 5 6 7 8 9 Heroku_Message__c( Account__c = {When parent of Social Persona is Account, Id of that parent},//Or AccountId of Contact when Parent is Contact Contact__c = {When parent of Social Persona is Contact, Id of that parent},//Or PersonContactId of Account when Parent is Account Related_Lead__c = {Id of found Lead},//Only when existing Conversation__c = {Id of found/created Conversation__c}, Related_Case__c = {Id of found/created Case},//Only when existing Related_Opportunity__c = {Id of found/created Opportunity},//Only when existing Social_Persona__c = {Id of the found/created Social Persona}, )