Activity Forums Salesforce® Discussions FeedItem through apexrest

  • FeedItem through apexrest

    Posted by Nitish on April 30, 2016 at 5:34 pm

    When trying to create a FeedItem through the ApexRest I'm always getting the following error:

    [{"errorCode":"APEX_ERROR","message":"System.DmlException: Insert failed. First exception on row 0; first error: REQUIRED_FIELD_MISSING, Required fields are missing: [Body]: [Body]\n\nClass.WS_SALES_V1_Document.post: line 61, column 1"}]

    But according to the Salesforce docs, the Body field is Optional when Type is ContentPost.
    Apex code of FeedItem creation(the insert fi; is line 61 by the way):

    FeedItem fi = new FeedItem();
    fi.ParentId = o.Id;
    fi.Type = 'ContentPost';
    fi.Visibility = 'AllUsers';
    insert fi;

    Is it a bug? Is documentation not up-to-date?

    Surbhi replied 8 years, 4 months ago 2 Members · 1 Reply
  • 1 Reply
  • Surbhi

    Member
    June 13, 2016 at 7:54 am

    Hi Nitish,

    I think you have to provide the body for the feeditem. If I come to know any other solution for this, will surely let you know.

    Thanks

Log In to reply.

Popular Salesforce Blogs

Popular Salesforce Videos