Post

2 followers Follow
0
Avatar

Rest API - Get Attachments on Discussions Posts

Can you please help me with getting the id list of attachments on a discussion post?  For cases I am doing this:

Select AttachmentsCount,(Select Name from Documents) from Case

But including "(Select Name from Documents)" for discussion posts doesn't return anything for attachments:

Select Container.Name, AttachmentsCount ,Body,EntityType,post,(select name from documents) from DiscussionMessage

Is there another entity I need to query to get the attachments for discussion messages?

Joshua Smith Answered

Please sign in to leave a comment.

3 comments

0
Avatar

Hi Joshua,

You can try:

select entity.text, document.name from DiscussionMessageAttachmentLink.

Apparently retrieving relations for Discussion messages with CZQL doesn't work.

 

Hope this helps,

Ophir 

Ophir Kenig 0 votes
Comment actions Permalink
0
Avatar

Hi Ophir, that query works, but I need a reference back to the issue that the discussion is a child of.  I tried container.name, but that doesn't work.  How can I also get the parent id in this query?

Thanks,

Josh

Joshua Smith 0 votes
Comment actions Permalink
0
Avatar

Hi Joshua,

For issues the field name is Title. Check this out:

select entity.text, entity.container.title, document.name from DiscussionMessageAttachmentLink

Hope this helps,

Ophir

Ophir Kenig 0 votes
Comment actions Permalink