1

I've a got a strange question, (at least I assume it's strange, I can't find anything like it online) Essentially I'm looking to access the Keywords section of the Document object, I have a trigger that is started by a document being uploaded.

I read the content of the file to programmatically calculate the highest occurring words in the file (checked against a list of common words that are exempt).

So I used to the DocumentContentLink to let me read the body. Is there a means for me to insert the word(s) that I have gleaned into the Keyword?

The developer console only allows Select and Find so I can't figure out how to reach this value to insert anything.

I can see from the document docs that the keyword is selectable from here.

select name,body,authorID, keywords
from Document where id = '01541000001mo73'

If this is not reachable is there a way I can create a relationship between the calculated keywords and the file at least?

Anything at all would be a great help! I've been wracking my brains for this for a while. Thank you so much! Keywords

  • 1
    The keywords field is updatable. Have you tried anything (Like [var].keywords = 'ABCD')? Are you getting an error - developer.salesforce.com/docs/atlas.en-us.api.meta/api/… – Eric Feb 13 '17 at 5:36
  • I'm coming from the ContentDocument Object and trying to get the ID for the Document object in order to be able to change the keywords. – JetSparx Feb 13 '17 at 21:42
0

Works out for me

Id docId = '01563000000Dv9G'; // hardcoded doc ID
Document doc = [select name,body,authorID, keywords from Document where id=:docId];

System.debug(doc.keywords); // null
System.debug(doc.id); // 01563000000Dv9G

doc.keywords ='salesforce';
update doc;

Document updatedDoc = [select name,body,authorID, keywords from Document where id = :docId];

System.debug(updatedDoc.keywords); // output is "salesforce" 

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.