1

enter image description here

In the screenshot attached to this Question you can find one "pdf" enclosed inside a blackbox,I need to get this using SOQL.

I am neither able to get the Object storing this attachment nor the relationship name with knowledgeArticle object.

When I click on the attachment it takes me to the following URL

https://svaruas-dev-ed--c.ap2.content.force.com/servlet/fileField?id=0BE280000008UA6

0BE is a prefix for filefielddata however not able to Use this to deduce anything.

So could anybody help me in getting the Right SOQL for this

3
  • Check This, SOQL Query for Attachments Commented May 8, 2017 at 9:49
  • @naveen dhanaraj I looked into the attachment object however these are not getting stored there.Also the Id of the records in Attachment have a prefix 00P unlike 0BE in this case.thank u for looking into this
    – svaruas
    Commented May 8, 2017 at 11:32
  • did you look at the junction between the article - ContentDocumentLink - ContentDocument ?
    – cropredy
    Commented Oct 4, 2017 at 21:56

1 Answer 1

1

You can acquire the Base64 data of the attachment, along with its FileName.

Here is the query on the Article version I used: SELECT Id, KnowledgeArticleId,testing_Attachment__Name__s FROM Article__kav WHERE Id='Your Article Id' AND PublishStatus='online'

Now you can acquire the Attachment Body's base64 value on the article as per the instruction below:

  1. String contentURL = "YOUR SALESFORCE INSTANCE URL VALUE"/servlet/fileField?entityId=ArticleVersionId(From above query)&field=testing_Attachment__Body__s.

  2. PageReference pf = new PageReference(contentURL); pf.getContent();//this statement return the Blob value for the attachment/file body.

Do mention if this solves your problem.

-Jagjit

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .