Ich versuche Anhang über Apex und Docusign "CreateAndSendEnvelope" API zu senden (Datensatz hat einen Anhang) in Opportunity-Datensatz.Anhang kann nicht gesendet werden - Salesforce Docusign-API
Aber ich immer diese Fehlermeldung "Die DocuSign EnvelopeId: Ausnahme - System.CalloutException:. Web-Service-callout fehlgeschlagen: WebService einen SOAP-Fehler zurückgegeben: Fehler beim Ankertag Verarbeitung ungültig Dokument faultcode = Seife: Client faultactor = https://demo.docusign.net/api/3.0/dsapi.asmx "
Unten ist das Stück Code verwendet.
// Render the contract
System.debug('Rendering the contract');
PageReference pageRef = new PageReference('/apex/RenderContract');
pageRef.getParameters().put('id',contract.Id);
//Blob pdfBlob = pageRef.getContent();
Attachment att = [SELECT Id, Name, Body, ContentType FROM Attachment WHERE Parentid = :contract.Id LIMIT 1];
Blob pdfBlob = att.Body;
// Document
DocuSignAPI.Document document = new DocuSignAPI.Document();
document.ID = 1;
document.pdfBytes = EncodingUtil.base64Encode(pdfBlob);
document.Name = 'Contract';
document.FileExtension = 'pdf';
envelope.Documents = new DocuSignAPI.ArrayOfDocument();
envelope.Documents.Document = new DocuSignAPI.Document[1];
envelope.Documents.Document[0] = document;
// Recipient
System.debug('getting the contact');
Contact contact = [SELECT email, FirstName, LastName
from Contact where id = :contract.CustomerSignedId];
DocuSignAPI.Recipient recipient = new DocuSignAPI.Recipient();
recipient.ID = 1;
recipient.Type_x = 'Signer';
recipient.RoutingOrder = 1;
recipient.Email = contact.Email;
recipient.UserName = contact.FirstName + ' ' + contact.LastName;
// This setting seems required or you see the error:
// "The string '' is not a valid Boolean value.
// at System.Xml.XmlConvert.ToBoolean(String s)"
recipient.RequireIDLookup = false;
envelope.Recipients = new DocuSignAPI.ArrayOfRecipient();
envelope.Recipients.Recipient = new DocuSignAPI.Recipient[1];
envelope.Recipients.Recipient[0] = recipient;
// Tab
DocuSignAPI.Tab tab1 = new DocuSignAPI.Tab();
tab1.Type_x = 'SignHere';
tab1.RecipientID = 1;
tab1.DocumentID = 1;
tab1.AnchorTabItem = new DocuSignAPI.AnchorTab();
tab1.AnchorTabItem.AnchorTabString = 'By:';
DocuSignAPI.Tab tab2 = new DocuSignAPI.Tab();
tab2.Type_x = 'DateSigned';
tab2.RecipientID = 1;
tab2.DocumentID = 1;
tab2.AnchorTabItem = new DocuSignAPI.AnchorTab();
tab2.AnchorTabItem.AnchorTabString = 'Date Signed:';
envelope.Tabs = new DocuSignAPI.ArrayOfTab();
envelope.Tabs.Tab = new DocuSignAPI.Tab[2];
envelope.Tabs.Tab[0] = tab1;
envelope.Tabs.Tab[1] = tab2;
System.debug('Calling the API');
try {
DocuSignAPI.EnvelopeStatus es
= dsApiSend.CreateAndSendEnvelope(envelope);
envelopeId = es.EnvelopeID;
} catch (CalloutException e) {
System.debug('Exception - ' + e);
envelopeId = 'Exception - ' + e;
}
Irgendwelche Ideen, um diesen Fehler zu überwinden?
Danke.
Auf welchem Server befindet sich Ihr docusign-Konto (sieht wie eine Demo aus, prüft aber nur)? Wann hast du diesen Fehler gesehen? – Andrew
es ist Demo-Server ..ich sah diesen Fehler eine Stunde zurück .. zunächst versuchte ich den Code in diesem Link: [link] (http://developer.force.com/cookbook/recipe/accessing-docusign-api- From-salesforcecom-to-send-contracts-for-esignatures. Und es funktionierte gut beim Rendern des gesamten Datensatzes zu pdf ... aber jetzt habe ich versucht, nur Anhänge anstelle von ganzen Datensatz zu senden .. Ich fing an, diesen Fehler zu bekommen .. irgendwelche Eingänge pls..tnx – visu