We have a need to do the following a) allow the user to post using our canvas app. The post is a simple TextPost, though it could be a CanvasPost b) After the user clicks share, get the feedItem record Id of the just posted item and do some stuff with that record.

To put it mildly I'm a n00b here, and it confuses me that there appears to be no easy way to do this?

Clarification: The canvas app is called from a publisher action

  • Check out the Heroku Quickstart app for Canvas. One of the things it does it to post to the feed, and I'm pretty sure that the post will return the feeditem's id. – metadaddy Sep 19 '14 at 2:56
  • Your proposal is we post a chatter item manually. That would work, but was not the plan. We were using a custom Publisher and letting them type in their type. A reasonable person might point out a) hey you can hide the Share button and make your own that activates the POST. However in this case we are specifically parsing the mentions, and don't really want to implement our own mention completion lookup!. So I believe your answer is, sadly wrong. Salesforce does NOT send an event after the share with a payload of the newly posted item. – MJB Sep 19 '14 at 21:26
  • I didn't propose you post a chatter item manually, I just pointed to the Heroku Quickstart app as containing code that shows how to post to the feed. Where are you posting from? JavaScript on the page, or from the Canvas app back end? Also, I didn't say that Salesforce sends an event after a share, I suggested that the post might return an id. Looking at the sample for posting to a feed, isn't the feed item id in the body of the 201 response? – metadaddy Sep 21 '14 at 18:17
  • We don't have access to the response because we dont call that sample. We are a PUBLISHER. So the SHARE button gets hit, we get getPayload, setPayload called and finally success (which would be nice if it had said payload). The actual post to chatter is handled by SF. That's the whole problem ;) – MJB Sep 22 '14 at 18:58
  • OK - I see now - I haven't used getPayload/setPayload. I'll see if I can find someone who knows this stuff better than I do! – metadaddy Sep 22 '14 at 20:32

I don't think this is possible - I was going to say listen for the success event

{name : 'publisher.success', onData : handlers.onSuccess}

However, looking at the code we don't send anything back in the payload. (Would need to enhance the code)

One workaround is to hide the header and footer (these are options when defining the connected app). You would then have to implement the Share functionality yourself. Not ideal, also may be tricky getting the feed to refresh after you post your message.

  • yes I considered that, but in this case one of the things we are parsing for is mentions and topics. While this could be reinvented too, it would chew up api calls and be tedious. I would LOVE for success to pass such information - it seems a very useful and reasonable thing! – MJB Sep 23 '14 at 1:57
  • FYI, on a similar project we hid the share and text, and implemented it all ourselves. This is kind of lame to do TBH, though it did work. Also, you need to know about the s1.navigateToFeed event to get the item to close. This worked ok, because in this similar project we didn't need to implement hashtag and mention lookups. You can do that with the API IIRC, but it seems pretty lame to have to do so. – MJB Oct 14 '14 at 16:55

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.