Developing Apex Triggers for Chatter
Chad Smith, Senior Consultant
Alternative Technology Solutions
@chad_w_smith
Safe harbor
Safe harbor statement under the Private Securities Litigation Reform Act of 1995:
This presentation may contain forward-looking statements that involve risks, uncertainties, and assumptions. If any such uncertainties
materialize or if any of the assumptions proves incorrect, the results of salesforce.com, inc. could differ materially from the results
expressed or implied by the forward-looking statements we make. All statements other than statements of historical fact could be
deemed forward-looking, including any projections of product or service availability, subscriber growth, earnings, revenues, or other
financial items and any statements regarding strategies or plans of management for future operations, statements of belief, any
statements concerning new, planned, or upgraded services or technology developments and customer contracts or use of our services.
The risks and uncertainties referred to above include – but are not limited to – risks associated with developing and delivering new
functionality for our service, new products and services, our new business model, our past operating losses, possible fluctuations in our
operating results and rate of growth, interruptions or delays in our Web hosting, breach of our security measures, the outcome of any
litigation, risks associated with completed and any possible mergers and acquisitions, the immature market in which we operate, our
relatively limited operating history, our ability to expand, retain, and motivate our employees and manage our growth, new releases of our
service and successful customer deployment, our limited history reselling non-salesforce.com products, and utilization and selling to
larger enterprise customers. Further information on potential factors that could affect the financial results of salesforce.com, inc. is
included in our annual report on Form 10-K for the most recent fiscal year and in our quarterly report on Form 10-Q for the most recent
fiscal quarter. These documents and others containing important disclosures are available on the SEC Filings section of the Investor
Information section of our Web site.
Any unreleased services or features referenced in this or other presentations, press releases or public statements are not currently
available and may not be delivered on time or at all. Customers who purchase our services should make the purchase decisions
based upon features that are currently available. Salesforce.com, inc. assumes no obligation and does not intend to update these
forward-looking statements.
Chad Smith
Senior Consultant,
Alternative Technology Solutions
@chad_w_smith
#SFChatterTrigger
Agenda
▪ Trigger Architecture
• Single trigger per object
• Utility Class for processing and DML operation

▪ Chatter Objects
• FeedItem
• EntitySubscription

▪ Example #1 – Auto-post to “Customer Win” Chatter Group
▪ Example #2 – Manager auto-follow “Big Deals”
▪ Example #3 – Auto-add new users to “Salesforce Q&A” Chatter Group
… before we begin
▪ Who is using Chatter now?
▪ Who is using trigger with Chatter?
▪ Who has written a trigger before?
Trigger Architecture
▪ Problems with multiple triggers on the same object
• Cannot control order of execution
• Organization of the org

▪ Solution

Class Code

• Single trigger per object
• Processing and DML
done within utility class

Trigger

Class Code

DML Statement
FeedItem Object
▪ “FeedItem represents an entry in the feed, such as changes in a record
feed, including text posts, link posts, and content posts.”
▪ Important Fields
• Body (Textarea) – The text or ‘body’ of the post
• ParentID (ID) – Chatter Group ID, AccountID, UserID (Profile Post)
• Type (Picklist) – TextPost, LinkPost, PollPost

▪ http://www.salesforce.
com/us/developer/docs/api/Content/sforce_api_objects_feeditem.htm
EntitySubscription Object
▪ “Represents a subscription for a user following a record or another
user.”
▪ Important Fields
• NetworkID (ID) – Community ID
• ParentID (ID) – ID of the record being followed
• SubscriberID (ID) – ID of the user following the record.

▪ Add Link to Docs
CollaborationGroupMember Object
▪ “Represents a member of a Chatter group.”
▪ Important Fields
• CollaborationGroupID (ID) – Chatter Group ID
• CollaborationRole (Picklist) – Admin or Standard
• MemberID (ID) – UserID of the Member
• NotificationFrequency (Picklist) – D for Daily, W for Weekly, N for Never, P for
Post

▪ http://www.salesforce.
com/us/developer/docs/api/Content/sforce_api_objects_collaborationgr
oupmember.htm
Object Model
Example #1 – Auto-Post to “Customer Win” Chatter
Group
▪ Post information to your “Customer Win” Chatter Group when your
opportunity goes to “Closed Won”
▪ Celebrate Victories!
▪ Minimize Emails in favor of Chatter (Chatter Adoption)
▪ Other Ideas
• Opportunity Next Action Group
• Project Next Action Group

▪ Code Walk Through
Example #2 – Manager Auto-Follow for Big Deals
▪ Set manager of a user to follow any opportunity over $5,000.
▪ Code Walk Through
Example #3 – Add new users to the “Salesforce
Q&A” Chatter Group
▪ Salesforce Chatter Group for Salesforce Questions & Answers
▪ Minimize support emails for your Administrator
▪ Drive Salesforce & Chatter Adoption
Deck & Code
▪ Dreamforce Session Chatter
▪ Alternative Technology Solutions Website
• http://alttechsolutions.com/http://alttechsolutions.com/SFtrigger
Email me!
• csmith@alttechsolutions.com
Chad Smith
Senior Consultant,
Alternative Technology Solutions

@chad_w_smith
Developing Apex Triggers for Chatter

More Related Content

PDF
Coding Apex Triggers on Chatter Group Members
PDF
Coding for Declarative Customizations: How We Do It in Salesforce.com IT
PDF
Salesforce Tour Paris - Platform Events - Martin Lezer
PDF
All Aboard the Lightning Components Action Service
PPTX
Coding Apps in the Cloud with Force.com - Part 2
PDF
Beyond Custom Metadata Types
PPTX
The SEAN stack - Build Web Apps With Salesforce, Express, Angular and Node.js
PPTX
Building BOTS on App Cloud
Coding Apex Triggers on Chatter Group Members
Coding for Declarative Customizations: How We Do It in Salesforce.com IT
Salesforce Tour Paris - Platform Events - Martin Lezer
All Aboard the Lightning Components Action Service
Coding Apps in the Cloud with Force.com - Part 2
Beyond Custom Metadata Types
The SEAN stack - Build Web Apps With Salesforce, Express, Angular and Node.js
Building BOTS on App Cloud

What's hot (20)

PDF
Developing Interactive Tables and Charts in Visualforce
PPTX
Mds cloud saturday 2015 salesforce intro
PDF
Making Your Apex and Visualforce Reusable
PDF
The Visual Delta Force: Dynamic Visualforce Components
PDF
Lightning Connect Custom Adapters: Connecting Anything with Salesforce
PDF
Salesforce API Series: Integrating Applications with Force.com Webinar
PPT
Salesforce Integration
PPTX
Atl elevate programmatic developer slides
PPTX
Lightning components performance best practices
PDF
Unlocking the Hidden Potential of Salesforce Live Agent
PPT
Elevate workshop programmatic_2014
PDF
Salesforce DX Pilot Product Overview
PPTX
Build Better Communities with Lightning
PPTX
Introduction to Apex for Developers
PDF
ISV Tech Enablement Webinar April 2017
PPTX
Modeling and Querying Data and Relationships in Salesforce
PPTX
Real Time Integration with Salesforce Platform Events
PPTX
Using Apex for REST Integration
PPTX
Coding in the App Cloud
PDF
Build Amazing Website without coding using Salesforce SiteForce
Developing Interactive Tables and Charts in Visualforce
Mds cloud saturday 2015 salesforce intro
Making Your Apex and Visualforce Reusable
The Visual Delta Force: Dynamic Visualforce Components
Lightning Connect Custom Adapters: Connecting Anything with Salesforce
Salesforce API Series: Integrating Applications with Force.com Webinar
Salesforce Integration
Atl elevate programmatic developer slides
Lightning components performance best practices
Unlocking the Hidden Potential of Salesforce Live Agent
Elevate workshop programmatic_2014
Salesforce DX Pilot Product Overview
Build Better Communities with Lightning
Introduction to Apex for Developers
ISV Tech Enablement Webinar April 2017
Modeling and Querying Data and Relationships in Salesforce
Real Time Integration with Salesforce Platform Events
Using Apex for REST Integration
Coding in the App Cloud
Build Amazing Website without coding using Salesforce SiteForce
Ad

Similar to Developing Apex Triggers for Chatter (20)

PDF
Introduction to Force.com
PDF
Moving Sharing to a Parallel Architecture
PPT
Improving Customer Service with a Branded Self Service Portal
PPT
Building Visualforce Custom Events Handlers
PDF
Visualforce Hack for Junction Objects
PDF
Introduction to Data.com APIs
PDF
ISV Tech Talk: Usage Metrics (October 15, 2014)
PDF
Extracting Microservices from your Monolithic org - Strategies and Tactics
PPTX
Txd19 speaker session template v1
PPTX
Salesforce knowledge user group july2013
PDF
Admin Best Practices: Remove Security Risk From Your Org with a User Audit
PPTX
The Power of Salesforce APIs World Tour Edition
PDF
Building Mobile Apps That Deliver Salesforce to Your Employees
PDF
Data.com APIs in Action ? Bringing Data to Life in Salesforce
PDF
Become a Superstar Admin with Custom Metadata Types
PPT
Aan010 Young 091907
PPTX
Singapore dg salesforce einstein + spring 17 release by manish
PPTX
CCT London 2013 Theatre Intro to Apex
PPTX
Platform Encryption World Tour Admin Zone
PDF
Tour of Heroku + Salesforce Integration Methods
Introduction to Force.com
Moving Sharing to a Parallel Architecture
Improving Customer Service with a Branded Self Service Portal
Building Visualforce Custom Events Handlers
Visualforce Hack for Junction Objects
Introduction to Data.com APIs
ISV Tech Talk: Usage Metrics (October 15, 2014)
Extracting Microservices from your Monolithic org - Strategies and Tactics
Txd19 speaker session template v1
Salesforce knowledge user group july2013
Admin Best Practices: Remove Security Risk From Your Org with a User Audit
The Power of Salesforce APIs World Tour Edition
Building Mobile Apps That Deliver Salesforce to Your Employees
Data.com APIs in Action ? Bringing Data to Life in Salesforce
Become a Superstar Admin with Custom Metadata Types
Aan010 Young 091907
Singapore dg salesforce einstein + spring 17 release by manish
CCT London 2013 Theatre Intro to Apex
Platform Encryption World Tour Admin Zone
Tour of Heroku + Salesforce Integration Methods
Ad

More from Salesforce Developers (20)

PDF
Sample Gallery: Reference Code and Best Practices for Salesforce Developers
PDF
Maximizing Salesforce Lightning Experience and Lightning Component Performance
PDF
Local development with Open Source Base Components
PPTX
TrailheaDX India : Developer Highlights
PDF
Why developers shouldn’t miss TrailheaDX India
PPTX
CodeLive: Build Lightning Web Components faster with Local Development
PPTX
CodeLive: Converting Aura Components to Lightning Web Components
PPTX
Enterprise-grade UI with open source Lightning Web Components
PPTX
TrailheaDX and Summer '19: Developer Highlights
PDF
Live coding with LWC
PDF
Lightning web components - Episode 4 : Security and Testing
PDF
LWC Episode 3- Component Communication and Aura Interoperability
PDF
Lightning web components episode 2- work with salesforce data
PDF
Lightning web components - Episode 1 - An Introduction
PDF
Migrating CPQ to Advanced Calculator and JSQCP
PDF
Scale with Large Data Volumes and Big Objects in Salesforce
PDF
Replicate Salesforce Data in Real Time with Change Data Capture
PDF
Modern Development with Salesforce DX
PDF
Get Into Lightning Flow Development
PDF
Integrate CMS Content Into Lightning Communities with CMS Connect
Sample Gallery: Reference Code and Best Practices for Salesforce Developers
Maximizing Salesforce Lightning Experience and Lightning Component Performance
Local development with Open Source Base Components
TrailheaDX India : Developer Highlights
Why developers shouldn’t miss TrailheaDX India
CodeLive: Build Lightning Web Components faster with Local Development
CodeLive: Converting Aura Components to Lightning Web Components
Enterprise-grade UI with open source Lightning Web Components
TrailheaDX and Summer '19: Developer Highlights
Live coding with LWC
Lightning web components - Episode 4 : Security and Testing
LWC Episode 3- Component Communication and Aura Interoperability
Lightning web components episode 2- work with salesforce data
Lightning web components - Episode 1 - An Introduction
Migrating CPQ to Advanced Calculator and JSQCP
Scale with Large Data Volumes and Big Objects in Salesforce
Replicate Salesforce Data in Real Time with Change Data Capture
Modern Development with Salesforce DX
Get Into Lightning Flow Development
Integrate CMS Content Into Lightning Communities with CMS Connect

Recently uploaded (20)

PPTX
2018-HIPAA-Renewal-Training for executives
PPT
Module 1.ppt Iot fundamentals and Architecture
PDF
sbt 2.0: go big (Scala Days 2025 edition)
PDF
Enhancing plagiarism detection using data pre-processing and machine learning...
PPTX
The various Industrial Revolutions .pptx
PPTX
Final SEM Unit 1 for mit wpu at pune .pptx
PDF
CloudStack 4.21: First Look Webinar slides
PDF
Convolutional neural network based encoder-decoder for efficient real-time ob...
PDF
OpenACC and Open Hackathons Monthly Highlights July 2025
PDF
How IoT Sensor Integration in 2025 is Transforming Industries Worldwide
PDF
A proposed approach for plagiarism detection in Myanmar Unicode text
PDF
The influence of sentiment analysis in enhancing early warning system model f...
PPTX
Modernising the Digital Integration Hub
PDF
STKI Israel Market Study 2025 version august
PDF
Five Habits of High-Impact Board Members
PPT
Galois Field Theory of Risk: A Perspective, Protocol, and Mathematical Backgr...
PPTX
Chapter 5: Probability Theory and Statistics
PPTX
GROUP4NURSINGINFORMATICSREPORT-2 PRESENTATION
PPTX
Benefits of Physical activity for teenagers.pptx
PPTX
Custom Battery Pack Design Considerations for Performance and Safety
2018-HIPAA-Renewal-Training for executives
Module 1.ppt Iot fundamentals and Architecture
sbt 2.0: go big (Scala Days 2025 edition)
Enhancing plagiarism detection using data pre-processing and machine learning...
The various Industrial Revolutions .pptx
Final SEM Unit 1 for mit wpu at pune .pptx
CloudStack 4.21: First Look Webinar slides
Convolutional neural network based encoder-decoder for efficient real-time ob...
OpenACC and Open Hackathons Monthly Highlights July 2025
How IoT Sensor Integration in 2025 is Transforming Industries Worldwide
A proposed approach for plagiarism detection in Myanmar Unicode text
The influence of sentiment analysis in enhancing early warning system model f...
Modernising the Digital Integration Hub
STKI Israel Market Study 2025 version august
Five Habits of High-Impact Board Members
Galois Field Theory of Risk: A Perspective, Protocol, and Mathematical Backgr...
Chapter 5: Probability Theory and Statistics
GROUP4NURSINGINFORMATICSREPORT-2 PRESENTATION
Benefits of Physical activity for teenagers.pptx
Custom Battery Pack Design Considerations for Performance and Safety

Developing Apex Triggers for Chatter

  • 1. Developing Apex Triggers for Chatter Chad Smith, Senior Consultant Alternative Technology Solutions @chad_w_smith
  • 2. Safe harbor Safe harbor statement under the Private Securities Litigation Reform Act of 1995: This presentation may contain forward-looking statements that involve risks, uncertainties, and assumptions. If any such uncertainties materialize or if any of the assumptions proves incorrect, the results of salesforce.com, inc. could differ materially from the results expressed or implied by the forward-looking statements we make. All statements other than statements of historical fact could be deemed forward-looking, including any projections of product or service availability, subscriber growth, earnings, revenues, or other financial items and any statements regarding strategies or plans of management for future operations, statements of belief, any statements concerning new, planned, or upgraded services or technology developments and customer contracts or use of our services. The risks and uncertainties referred to above include – but are not limited to – risks associated with developing and delivering new functionality for our service, new products and services, our new business model, our past operating losses, possible fluctuations in our operating results and rate of growth, interruptions or delays in our Web hosting, breach of our security measures, the outcome of any litigation, risks associated with completed and any possible mergers and acquisitions, the immature market in which we operate, our relatively limited operating history, our ability to expand, retain, and motivate our employees and manage our growth, new releases of our service and successful customer deployment, our limited history reselling non-salesforce.com products, and utilization and selling to larger enterprise customers. Further information on potential factors that could affect the financial results of salesforce.com, inc. is included in our annual report on Form 10-K for the most recent fiscal year and in our quarterly report on Form 10-Q for the most recent fiscal quarter. These documents and others containing important disclosures are available on the SEC Filings section of the Investor Information section of our Web site. Any unreleased services or features referenced in this or other presentations, press releases or public statements are not currently available and may not be delivered on time or at all. Customers who purchase our services should make the purchase decisions based upon features that are currently available. Salesforce.com, inc. assumes no obligation and does not intend to update these forward-looking statements.
  • 3. Chad Smith Senior Consultant, Alternative Technology Solutions @chad_w_smith #SFChatterTrigger
  • 4. Agenda ▪ Trigger Architecture • Single trigger per object • Utility Class for processing and DML operation ▪ Chatter Objects • FeedItem • EntitySubscription ▪ Example #1 – Auto-post to “Customer Win” Chatter Group ▪ Example #2 – Manager auto-follow “Big Deals” ▪ Example #3 – Auto-add new users to “Salesforce Q&A” Chatter Group
  • 5. … before we begin ▪ Who is using Chatter now? ▪ Who is using trigger with Chatter? ▪ Who has written a trigger before?
  • 6. Trigger Architecture ▪ Problems with multiple triggers on the same object • Cannot control order of execution • Organization of the org ▪ Solution Class Code • Single trigger per object • Processing and DML done within utility class Trigger Class Code DML Statement
  • 7. FeedItem Object ▪ “FeedItem represents an entry in the feed, such as changes in a record feed, including text posts, link posts, and content posts.” ▪ Important Fields • Body (Textarea) – The text or ‘body’ of the post • ParentID (ID) – Chatter Group ID, AccountID, UserID (Profile Post) • Type (Picklist) – TextPost, LinkPost, PollPost ▪ http://www.salesforce. com/us/developer/docs/api/Content/sforce_api_objects_feeditem.htm
  • 8. EntitySubscription Object ▪ “Represents a subscription for a user following a record or another user.” ▪ Important Fields • NetworkID (ID) – Community ID • ParentID (ID) – ID of the record being followed • SubscriberID (ID) – ID of the user following the record. ▪ Add Link to Docs
  • 9. CollaborationGroupMember Object ▪ “Represents a member of a Chatter group.” ▪ Important Fields • CollaborationGroupID (ID) – Chatter Group ID • CollaborationRole (Picklist) – Admin or Standard • MemberID (ID) – UserID of the Member • NotificationFrequency (Picklist) – D for Daily, W for Weekly, N for Never, P for Post ▪ http://www.salesforce. com/us/developer/docs/api/Content/sforce_api_objects_collaborationgr oupmember.htm
  • 11. Example #1 – Auto-Post to “Customer Win” Chatter Group ▪ Post information to your “Customer Win” Chatter Group when your opportunity goes to “Closed Won” ▪ Celebrate Victories! ▪ Minimize Emails in favor of Chatter (Chatter Adoption) ▪ Other Ideas • Opportunity Next Action Group • Project Next Action Group ▪ Code Walk Through
  • 12. Example #2 – Manager Auto-Follow for Big Deals ▪ Set manager of a user to follow any opportunity over $5,000. ▪ Code Walk Through
  • 13. Example #3 – Add new users to the “Salesforce Q&A” Chatter Group ▪ Salesforce Chatter Group for Salesforce Questions & Answers ▪ Minimize support emails for your Administrator ▪ Drive Salesforce & Chatter Adoption
  • 14. Deck & Code ▪ Dreamforce Session Chatter ▪ Alternative Technology Solutions Website • http://alttechsolutions.com/http://alttechsolutions.com/SFtrigger Email me! • csmith@alttechsolutions.com
  • 15. Chad Smith Senior Consultant, Alternative Technology Solutions @chad_w_smith