I am new to Apex and I have the following code to call a function each time a new Chatter post is created:
public class MLPost {
public static void MLPostCreate(FeedItem post) {
for (FeedItem p : post){
MLProjectHttpCallout.postContent(p.Body);
}
}
}
I am getting this error and don't know what it means:
Compile Error: Loop must iterate over a collection type: SOBJECT:FeedItem
My trigger to call the above code is as follows:
trigger MLPostTrigger on FeedItem (before insert) {
FeedItem posts = Trigger.new;
MLPost.MLPostCreate(posts);
}
I get the following error when trying to compile the trigger code:
Error: Compile Error: Illegal assignment from LIST to SOBJECT:FeedItem at line 3 column 5
Any help would be greatly appreciated.