You need to sign in to do that
Don't have an account?
How do i public Content to Library?
I need to insert Content into my test class so that I can test a method. The problem is that I have custom fields and get the error:
System.DmlException: Insert failed. First exception on row 0; first error: FIELD_INTEGRITY_EXCEPTION, You cannot set custom fields or tags on a document published into a personal library. Fields set: Type of Document,Quarter: []
So I need to figure out how to publish into a personal library to set these fields. Does anyone know how to do this through code?
ContentVersion version = new ContentVersion(); version.Title = 'test'; version.ContentUrl = 'www.google.com/'; version.Quarter__c = 'Test Quarter'; version.Type_of_Document__c = 'Test type'; insert version;
I also tried creating an account in the test class and setting the
version.FirstPublishLocationId = acc.Id;
and got the error:
System.DmlException: Insert failed. First exception on row 0; first error: INSUFFICIENT_ACCESS_ON_CROSS_REFERENCE_ENTITY, Content cannot be inserted as a child of record 001V0000007AcyK.: [FirstPublishLocationId]