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
Surya Chandra Rao GandreddiSurya Chandra Rao Gandreddi 

forcetk createblob to FeedItem

Hi,

I'm trying to use forcetk to create a ChatterFile on an object as below:

forcetkClient.createBlob(
    'FeedItem', {
        'ParentId': 'xxxxxxxx', // Custom Object Id
        'ContentFileName': file.name,
        'Type': 'ContentPost',
    }, file.name, 'ContentData', file,
    function(response) {
        console.log(response);
    },
    function(request, status, response) {
        console.log("Error: " + status);
    }
);

But then I get the below error:
[{"message":"Unable to create/update fields: ContentType. Please check the security settings of this field and verify that it is read/write for your profile or permission set.","errorCode":"INVALID_FIELD_FOR_INSERT_UPDATE","fields":["ContentType"]}]

Any suggestions on what I'm missing or doing wrong.

Thanks
dmeyer marley paigedmeyer marley paige
put the file in contentversion then use the id you get back to create a feeditem with the contentversionid as the relatedrecordid and your customobject id as the parentid on the feeditem. you could do that from javascript or add a field to contentversion and a trigger that creates the feeditem