You need to sign in to do that
Don't have an account?
Uday K
Test Class error when inserting QuoteDocument Object
Hello friends,
I have inserted QuoteDocument object in test class like below.
Quote Qu = New Quote(); qu.Name = 'Test Quote'; qu.OpportunityId = opp.Id; Insert qu; string before = 'Testing base 64 encode'; Blob beforeblob = Blob.valueOf(before); QuoteDocument qdoc = New QuoteDocument(); qdoc.QuoteId = qu.Id; qdoc.Document = body; insert qdoc;
In the hightlighted its giving error :
System.DmlException: Insert failed. First exception on row 0; first error: REQUIRED_FIELD_MISSING, This field is required: [VersionData]
Can someone tell What is VersionData Field, How to pass value in test class. I have searched in salesforce documentation also, I didn't find any such Field of VersionData in QuoteDocument object.
Looking ahead for earlier response...
Thanks in Advance,
Uday
Hi,
The VersionData field didn't appear to be present in the object, but the 'document' field existed and it must be in blob type
Try this,
qdoc.Document = beforeblob; or
qdoc.Document = Blob.toPdf('Test Document');
All Answers
Hi,
The VersionData field didn't appear to be present in the object, but the 'document' field existed and it must be in blob type
Try this,
qdoc.Document = beforeblob; or
qdoc.Document = Blob.toPdf('Test Document');
Hello Sfd developer,
It worked great.
Thanks a tonnn.
Uday