You need to sign in to do that
Don't have an account?
Feng
the code newatt.Body = 0; failed
How to assign value to body field of an attachment record ?
when i try to create an attachment record in my testmethod
Code:
Attachment newatt = new Attachment(); newatt.Name = 'test attachment'; newatt.Body = 0; newatt.ParentId = obj.Id; insert newatt;
the code newatt.Body = 0; failed
how to assign value to the body field as this field is base64 data type
thanks in advance
Feng
ES
body is of type blob in apex. Look for examples of blob in apex dev-guide. simple example to convert string to blob is below,
Code: