function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
lapaullapaul 

Is there a way to pull records from a specified workspace in CRM content

HI,

This SOQL statement “Select Id, Title From ContentVersion”  will pull  all the records from the Salesforce CRM content.

Is there a way to pull records from a specified Workspace ?  I created 3 workspaces in CRM content and I only want to

pull records from certain workspaces using SOQL. Please help.

 

thanks,

Paul

 

SuperfellSuperfell
The ContentWorkspaceDoc object contains the list of which documents are in which worksapce.
lapaullapaul

Thanks for your reply. Looking at the ContentWorkspaceDoc, I don't see the title field. How can I pull the records

by titles in a specified workspace. could you give me some sample codes. Thanks.

 

- <complexType name="ContentWorkspaceDoc">
- <complexContent>
- <extension base="ens:sObject">
- <sequence>
  <element name="ContentDocument" nillable="true" minOccurs="0" type="ens:ContentDocument" />
  <element name="ContentDocumentId" nillable="true" minOccurs="0" type="tns:ID" />
  <element name="ContentWorkspace" nillable="true" minOccurs="0" type="ens:ContentWorkspace" />
  <element name="ContentWorkspaceId" nillable="true" minOccurs="0" type="tns:ID" />
  <element name="CreatedDate" nillable="true" minOccurs="0" type="xsd:dateTime" />
  <element name="IsDeleted" nillable="true" minOccurs="0" type="xsd:boolean" />
  <element name="IsOwner" nillable="true" minOccurs="0" type="xsd:boolean" />
  <element name="SystemModstamp" nillable="true" minOccurs="0" type="xsd:dateTime" />
  </sequence>
  </extension>
  </complexContent>
 
SuperfellSuperfell

You join between contentDocument and ConentWorkspaceDoc, e.g.

 

select contactDocumentId from contentWorkspaceDoc where contentWorkspaceId='someId' and contentDocument.Title like 'foo' 

lapaullapaul

I think you misunderstood from my last post. I want to select title but there's no title field in the

ContentWorkspaceDoc. so how can I join ContentWorkspaceDoc with contentVersion?

 

Example: 

select title from contentVersion

 

thanks

SuperfellSuperfell

See the SOQL docs,

 

select contentVersion.tile from contentWorkspaceDocs where contentWorkspaceId='someId' 

lapaullapaul

I've tried your suggested code and got the error message below. Any idea? Thanks

 

Error: Compile Error: Didn't understand relationship 'ContentVersion' in field path. If you are attempting to use a custom relationship, be sure to append the '__r' after the custom relationship name. Please reference your WSDL or the describe call for the appropriate names. at line 134 column 41

 

here's the exact code in my Apex controller class:

List<ContentWorkspaceDoc> wsdoc; 

wsdoc = (List<ContentWorkspaceDoc>) [Select ContentVersion.Title From ContentWorkspaceDoc where ContentWorkspaceId = '058A0000000POIIIA4'];

SuperfellSuperfell

I'd recommend you get upto speed with one of the schema view/query explorer tools, they'll help you resolve these kinds of problems much faster. 

 

Select ContentDocument.Title From ContentWorkspaceDoc where ContentWorkspaceId = '058A0000000POIIIA4'

lapaullapaul

 I tried the following SOQL and did not get the title but I got documentID instead. I'm not sure how to go about

doing this. Thanks for all your help.

 

Select ContentDocument.Title From ContentWorkspaceDoc where ContentWorkspaceId = '058A0000000POIIIA4'

(ContentWorkspaceDoc:{ContentDocumentId=069A0000000PQhdIAG, Id=059A0000000PP6VIAW})

lapaullapaul

I just figured out. It works now. All I need is to make a minor change in VForce page like this:

 

{!t.ContentDocument.title}

 

thanks.

hector.asp2hector.asp2

hi

 

is there any way we can fatch contact name or Id  along with ContentWorkspaceDoc ??

 

er.arunthakur@gmail.com 

http://cumulusforce.appspot.com/

SuperfellSuperfell
How are the contact and the content doc related ?
lapaullapaul

Hi,

I did not post that last question regarding the contact. Some body posted it.

 

thanks,

Paul