1

In order to create a new document and insert it to a specific folder via API, must I specify the folder in Database.insert (doc); method?

I am getting a missing required fields error when testing saying I am missing FolderId and Name fields but they are listed, my method is as follows:

Document doc = new Document();

doc.FolderId = (string)requestJson.get('SFDC unique ID of targeted folder");

doc.Body = Blob.valueOf('JSON string');

doc.Id = (string)requestJson.get('Id');

doc.Name = (string)requestJson.get('Name');

Database.insert(doc);

Map<String, Object> m = new Map<String, Object>();
m.put('success', true);
response.responseBody = Blob.valueOf(JSON.serialize(m));
2
  • 2
    Have you verified that the requestJson.get calls are returning none-null values?
    – Keith C
    Commented Nov 3, 2014 at 23:52
  • I was indeed getting a null value returned, I was also calling the wrong field for "name" on the front end, it works now, thanks for the nudge in the right direction Alex!
    – GuestCoder
    Commented Nov 4, 2014 at 20:17

0

You must log in to answer this question.

Browse other questions tagged .