2

Have been using the ConnectApiHelper from here https://github.com/forcedotcom/ConnectApiHelper

Appears this test class starting failing when calling the testCreateInputFromBody() testmethod.

It fails at line 260 when calling the following connectAPI feature.

ConnectApi.ChatterFeeds.postFeedElement(String, ConnectApi.FeedElementInput, ConnectApi.BinaryInput)

The test method results in the following error: Validation errors while saving records(s).

What I have found is if I modify the test method to comment out the following lines.. Starting at 241 the postFeedElement method successfully completes.

    //ConnectApi.MarkupBeginSegmentInput markupBeginSegmentInput = new ConnectApi.MarkupBeginSegmentInput();
    //markupBeginSegmentInput.markupType = ConnectApi.MarkupType.Bold;
    //messageBodyInput.messageSegments.add(markupBeginSegmentInput);

    textSegmentInput = new ConnectApi.TextSegmentInput();
    textSegmentInput.text = expectedBoldText;
    messageBodyInput.messageSegments.add(textSegmentInput);

    //ConnectApi.MarkupEndSegmentInput markupEndSegmentInput = new ConnectApi.MarkupEndSegmentInput();
    //markupEndSegmentInput.markupType = ConnectApi.MarkupType.Bold;
    //messageBodyInput.messageSegments.add(markupEndSegmentInput);

Anyone know why the ConnectApi.MarkupType.Bold messageSegment is causing this to fail?

here is the complete messageSegment that is being passed upon failure.

messageBodyInput: ConnectApi.MessageBodyInput[messageSegments=(ConnectApi.TextSegmentInput[text=Text http://link.com #hashtag], ConnectApi.MentionSegmentInput[id=005C0000004649rIAA], ConnectApi.MarkupBeginSegmentInput[markupType=Bold], ConnectApi.TextSegmentInput[text=Bold text], ConnectApi.MarkupEndSegmentInput[markupType=Bold])]

Thanks!

1

Just figured this out. If you navigate to setup Chatter - chatter settings. An option called Rich Text Posts was disabled. Enabling this option allows users to post rich text chatters and will get this class to successfully pass. Think this was added in winter 16 as I didn't see this error prior. Thanks!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.