0

My code is:

@AuraEnabled
public static string savedocs(String con, string name){// parameters i am getting from Js healper class. Here con is the JSON string contains list of object data.
        document doc=new document();
        doc.Name=name;
        doc.ContentType='.json';
        doc.IsPublic=True;
        doc.Body=con;// here i am getting error. illigal assignment string to blob.
        doc.FolderId='00l6A000000IiYW';
            insert doc;
}

Please help me how to achieve this.

1 Answer 1

0

You need to convert String into blob to assign the value. You can't directly assign string here.

Blob body = blob.valueOf(con);
doc.Body= body ;
2
  • i used that, But the record is not saved in to the document object. Commented Feb 13, 2018 at 10:28
  • @ArjunReddy Are you getting any exception? Did this method get called? Commented Feb 13, 2018 at 10:47

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .