Slaesforce FAQ

how to create a postapex inset feeditem salesforce

by Johnnie Zemlak Published 3 years ago Updated 2 years ago
image

The following code may help you: //Adding a Text post FeedItem post = new FeedItem (); post.ParentId = oId; //eg. Opportunity id, custom object id.. post.Body = 'Enter post text here';

Full Answer

How do I create a Chatter post from Apex in Salesforce?

To enable chatter all we have to do is go to the Setup|Customize|Chatter|Chatter Settings and enable chatter. After that a new chatter tab will be visible in specific apps. However someone might be having a specific requirement about posting data on chatter from APEX code.

How do you insert a record into Apex?

How do I add a record to a custom object in Apex? To create new records in Salesforce, select the custom object where the form data should be saved. Then, map the Salesforce fields with the form fields. The Salesforce fields will load according to the object you select.

How do I post a Chatter in Salesforce trigger?

Its very simple. Just write a trigger on Salesforce object named "FeedItem". On Feeditem object "ParentId" is the field where you can link the account record with the chatter post. Hope it help!

How do I add Apex code to Salesforce?

Adding an Apex ClassFrom Setup, enter “Apex Classes” in the Quick Find box, then select Apex Classes and click New.In the class editor, enter this class definition: public class MyHelloWorld { } ... Add this method definition between the class opening and closing brackets. ... Click Save to save the new class.

What is insert in Apex?

Important. This example inserts three account records and updates an existing account record. First, three Account sObjects are created and added to a list. An insert statement bulk inserts the list of accounts as an argument.

How do I create a new record in SalesForce?

Create Records from Object Home PagesClick the object for the kind of record you want to create. For example, click Accounts if you want to create an account record.Click New.Select a record type if you're prompted.Enter values in the fields. ... Save your changes, when you finish entering values for your new record.

How do you post on Chatter?

0:041:11Let's learn to Post Something to Chatter @salesforce - YouTubeYouTubeStart of suggested clipEnd of suggested clipOnce you share your post you can find it by searching for take it to chatter. You also find anyMoreOnce you share your post you can find it by searching for take it to chatter. You also find any other post that was tagged hashtag take it to chatter. Click share or press ctrl + Enter.

How do I post to Chatter in process builder?

Choose “Post to Chatter” in “Action Type” and Choose “Chatter Group” in Post to then find the Chatter group which your org already have. Otherwise create a chatter group. Also Enter a Message like “New'Customer Direct' Account is created”. Step 6: Activate the process Builder.

How do I send a Chatter message in Salesforce?

Required Editions Click the Messages link on the Chatter tab, then click New Message in My Messages. Open a person's profile by clicking their name anywhere in Chatter, and then click Send a message. Click Send a message on a person's hover.

How do I create a custom object in Salesforce using apex?

Create a Custom ObjectLog in to your sandbox or Developer org.From your management settings for custom objects, if you're using Salesforce Classic, click New Custom Object, or if you're using Lightning Experience, select Create | Custom Object.Enter Book for the label.Enter Books for the plural label.Click Save.More items...

How do I start an Apex code?

Quick Start: Apex Coding for AdminsExecute Anonymous Blocks. ~10 mins.Create a BankAcct and CreateContactFromCan Class. ~5 mins.Instantiate an Object and Invoke a Method from Execute Anonymous. ... Create a List. ... Create a List FOR Loop. ... Use DML to Save sObjects to the Database. ... Create SOQL to Return Data to Apex. ... Create a Trigger.

How do you write a batch Apex?

To write a Batch Apex class, your class must implement the Database.Batchable interface and include the following three methods:start. Used to collect the records or objects to be passed to the interface method execute for processing. ... execute. ... finish.

Special Access Rules

You can delete all feed items you created. To delete feed items you didn’t create, you must have one of these permissions:

Usage

If you are using API version 23.0 or later and have “View All Data” permission, you can directly query for a FeedItem. The following example returns the 20 most recent feed items.

image
A B C D E F G H I J K L M N O P Q R S T U V W X Y Z 1 2 3 4 5 6 7 8 9