Multiple Documents and recipients - soap format issues - soap

I have to send 2 documents to 2 recipients via DocuSign soap api. 1st document should be signed by the 1st recipient, and then it should go to 2nd recipient to sign the 2nd document.
But when I send using the below soap format, the 1st recipient is prompted to sign on both documents, instead of just the 1st one. 2nd recipient is similarly messed up. Can you please advice what is wrong with this soap structure, or if I am missing any other elements?
Thanks
Soap format:
<ns0:Documents>
<ns0:Document>
<ns0:ID>1</ns0:ID>
<ns0:Name>TestDocuSign.pdf</ns0:Name>
<ns0:PDFBytes xmlns:xop="http://www.w3.org/2004/08/xop/include">bytes1</ns0:PDFBytes>
<ns0:TransformPdfFields>false</ns0:TransformPdfFields>
<ns0:FileExtension>pdf</ns0:FileExtension>
<ns0:AttachmentDescription>DS1</ns0:AttachmentDescription>
</ns0:Document>
<ns0:Document>
<ns0:ID>2</ns0:ID>
<ns0:Name>TestDocuSign2.pdf</ns0:Name>
<ns0:PDFBytes xmlns:xop="http://www.w3.org/2004/08/xop/include">bytes2</ns0:PDFBytes>
<ns0:TransformPdfFields>false</ns0:TransformPdfFields>
<ns0:FileExtension>pdf</ns0:FileExtension>
<ns0:AttachmentDescription>DS2</ns0:AttachmentDescription>
</ns0:Document>
<ns0:Recipients>
<ns0:Recipient>
<ns0:ID>1</ns0:ID>
<ns0:UserName>abc</ns0:UserName>
<ns0:SignerName>abcName</ns0:SignerName>
<ns0:Email>abc#yhoo.com</ns0:Email>
<ns0:Type>Signer</ns0:Type>
<ns0:AccessCode xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
<ns0:RoutingOrder>1</ns0:RoutingOrder>
</ns0:Recipient>
<ns0:Recipient>
<ns0:ID>2</ns0:ID>
<ns0:UserName>def</ns0:UserName>
<ns0:SignerName>defName</ns0:SignerName>
<ns0:Email>def#yhoo.com</ns0:Email>
<ns0:Type>Signer</ns0:Type>
<ns0:AccessCode xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
<ns0:RoutingOrder>2</ns0:RoutingOrder>
</ns0:Recipient>
</ns0:Recipients>
<ns0:Tabs>
<ns0:Tab>
<ns0:DocumentID>1</ns0:DocumentID>
<ns0:RecipientID>1</ns0:RecipientID>
<ns0:AnchorTabItem>
<ns0:AnchorTabString>SIGNATURE</ns0:AnchorTabString>
<ns0:XOffset>0.0</ns0:XOffset>
<ns0:YOffset>-10.0</ns0:YOffset>
<ns0:Unit>Pixels</ns0:Unit>
<ns0:IgnoreIfNotPresent>true</ns0:IgnoreIfNotPresent>
</ns0:AnchorTabItem>
<ns0:Type>SignHere</ns0:Type>
</ns0:Tab>
<ns0:Tab>
<ns0:DocumentID>2</ns0:DocumentID>
<ns0:RecipientID>2</ns0:RecipientID>
<ns0:AnchorTabItem>
<ns0:AnchorTabString>SIGNATURE</ns0:AnchorTabString>
<ns0:XOffset>50.0</ns0:XOffset>
<ns0:YOffset>-10.0</ns0:YOffset>
<ns0:Unit>Pixels</ns0:Unit>
<ns0:IgnoreIfNotPresent>true</ns0:IgnoreIfNotPresent>
</ns0:AnchorTabItem>
<ns0:Type>SignHere</ns0:Type>
</ns0:Tab>
</ns0:Tabs>

Seeing your code, it seems SIGNATURE anchorString is available on both documents. AnchorString scope is not limited to document level, instead it is at envelope level. When you mention AnchorString, DocuSign will search that anchorString in complete envelope, in your case it will find this string in both documents for both the recipients, hence both recipients are seeing Signature Tab on both documents. Solution is to change the Anchor String for both signers, make Signature1 for Signer1 and Signature2 for Signer2, then everything will work fine as Signarure1 will be present in Document1 and Signature2 will be only present in Document2.

Related

How to get purchase order documents from tradeShift API?

I am trying to get the trade shift purchase order using their API.
FYI, While I am making an API request,
I am using OAuth1.
I am using endpoint
https://api-sandbox.tradeshift.com/tradeshift/rest/external/documents?limit=5
In the header, When I set Accept as application/JSON, I am getting a response like
{
"itemsPerPage": 5,
"itemCount": 2,
"indexing": false,
"numPages": 1,
"pageId": 0,
"Document": []
}
But If I add nothing in the Header, I am getting an XML response.
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<ts:DocumentList xmlns:cec="urn:oasis:names:specification:ubl:schema:xsd:CommonExtensionComponents-2" xmlns:cbc="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2" xmlns:cac="urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2" xmlns:ts="http://tradeshift.com/api/public/1.0" xmlns:ns6="http://tradeshift.com/api/1.0" xmlns:ns7="http://tradeshift.com/api/2.0" xmlns:ns8="urn:oasis:names:specification:ubl:schema:xsd:Invoice-2" xmlns:ns9="urn:oasis:names:specification:ubl:schema:xsd:Quotation-2" xmlns:ns10="urn:oasis:names:specification:ubl:schema:xsd:CreditNote-2" xmlns:ns11="urn:oasis:names:specification:ubl:schema:xsd:Order-2" xmlns:ns12="urn:oasis:names:specification:ubl:schema:xsd:OrderChange-2" xmlns:ns13="urn:oasis:names:specification:ubl:schema:xsd:ApplicationResponse-2" xmlns:ns14="urn:oasis:names:specification:ubl:schema:xsd:Reminder-2" xmlns:ns15="urn:oasis:names:specification:ubl:schema:xsd:RemittanceAdvice-2" xmlns:ns16="urn:oasis:names:specification:ubl:schema:xsd:ReceiptAdvice-2" xmlns:ns17="urn:oasis:names:specification:ubl:schema:xsd:Catalogue-2" xmlns:ns18="https://tradeshift.com/documents/ubl/xsd/Requisition-2" xmlns:ns19="urn:oasis:names:specification:ubl:schema:xsd:OrderResponse-2" xmlns:ns20="urn:oasis:names:specification:ubl:schema:xsd:RequestForQuotation-2" xmlns:ns21="urn:oasis:names:specification:ubl:schema:xsd:OrderResponseSimple-2" xmlns:ns22="urn:oasis:names:specification:ubl:schema:xsd:OrderCancellation-2" xmlns:ns23="urn:oasis:names:specification:ubl:schema:xsd:DespatchAdvice-2" indexing="false" numPages="1" pageId="0" itemsPerPage="5" itemCount="2"/>
I am not quite sure if the document is already there as UBL format.
Can you please ensure, if the document is already there as UBL.
If document is there, then How can I parse the document?
And if the document is not there, how can I get the documents?
The document is not there, that both responses are the same just the format is different.
In order to get the Documents that you receive in your Tradeshift account you should follow the below steps:
get the list with all the documents available in your account using the below API:
GET https://api-sandbox.tradeshift.com/tradeshift/rest/external/documents?type=order Content-Type=application/json Accept=application/json Authorisation=oauth1
As response, you will have a JSON with all the orders in your account and the details you will need to retrieve the UBL file of the order.
From the JSON resulted in point 1 using the DocumentId of the order you want to get make the below call
GET https://api-sandbox.tradeshift.com/tradeshift/rest/external/documents/{DocumentUUID} Content-Type=application/json Accept=application/xml Authorisation=oauth1
Once you get a file in order to get it marked as processed you can also tag the document using the below API call:
PUT https://api.tradeshift.com/tradeshift/rest/external/documents/{DocumentId}/tags/{your-tag}
At the first call, you can then add more parameters like withouttag in order to filter out the documents you have tagged already, like in the below call:
`GET https://api-sandbox.tradeshift.com/tradeshift/rest/external/documents?type=order&withouttag={your-tag}`

Salesforce send Email by Apex

I'm making by a requirement a code able to send an E-mail to an specific list of E-mails, due the fact that I must to include the attachments of the record I decided to use an apex class instead an e-mail alert. This object (A custom object ) must populate some fields in an email template with some of the record´s fields. I implemented the following code
Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
mail.setToAddresses(lista);
mail.setTemplateId('00X21000000QR22');
//mail.setWhatId(idMinuta);
mail.setTargetObjectId('005d0000005NMIx');
mail.setSaveAsActivity(false);
List<Messaging.Emailfileattachment> fileAttachments = new List<Messaging.Emailfileattachment>();
for (ContentVersion document: documents)
{
Messaging.Emailfileattachment efa = new Messaging.Emailfileattachment();
efa.setFileName(document.Title);
efa.setBody(document.VersionData);
fileAttachments.add(efa);
}
mail.setFileAttachments(fileAttachments);
Messaging.sendEmail(new Messaging.SingleEmailMessage[] { mail });
I understood that to make the fields merge it´s necesary to use the WhatId method. In the related code, I have commented it because It generates an error (INVALID_ID_FIELD, WhatId is not available for sending emails to UserIds.)
My question is, if is it possible to do this with a custom object. I´m a little confuse with salesforce documentation beacuse it looks like the method supports a custom object, or maybe If I am forggeting something to include in the code.
If i keep the WhatID line commented, effectively the email is sent with the attachments and the Template but it is not populated.
I really need this kind of solution because the org have in this object at least 20 email templates, for me will be easier just to pass the Id of the template instead of makig a code with 20 different html codes for each situation
Thanks a lot
Please publish this question at Salesforce StackExcahnge https://salesforce.stackexchange.com/

Cannot pass value to SalesForce from Docusign Document, SOAP API, MergeFieldXml

Good day everyone,
I need to pass the value of a write-back field from docusign document to Salesforce.
Can you kindly provide an example of a string specifying the properties of MergeFieldXml like configuration type, path, etc.
According to Docusign SOAP API (https://www.docusign.net/api/3.0/dsapi.asmx?op=RequestEnvelopeWithDocumentFields) the MergeField property is passed as string:
<MergeFieldXml>string</MergeFieldXml>
At the same time the string should contain properties like:
Configuration type: salesforce (always)
path: objetc.field
row: record id
writeback: true if the data should be posted to salesforce.
My try does not work showing 'Web service callout failed: WebService returned a SOAP Fault: A Mergefield value for a Tab could not be retrieved. faultcode=soap:Client faultactor=missing in Web.Config
Row Number: 1196'
tab19.MergeFieldXml = '<configurationType>salesforce</configurationType><path>contact.Question_1_Agreement__c</path><writeback>true</writeback><allowSenderToEdit>false</allowSenderToEdit>';
If using REST API this would look as follows:
"mergeField": {
"configurationType":"Salesforce",
"path":"contact.Question_1_Agreement__c",
"writeback":"true",
"allowSenderToEdit":"true",
}
According to SOAP API documentation (https://www.docusign.com/p/APIGuide/APIGuide.htm#Sending Group/Tab.htm%3FTocPath%3DDocuSign%2520Service%2520API%2520Information%7CSending%2520Function%2520Group%7CCreateAndSendEnvelope%2520and%2520CreateEnvelope%7CTab%7C_____0)
MergeFieldXml is 'reserved for future'.
Does it mean it is not implemented yet?
how do we pass values back to salesforce using SOAP MergeFieldXml?
Or there may be some other way to accomplish this?
Thank you for any advise.

What is an InstallationID in Quickbooks QBMSXML

I have a qbmsxml that I'm sending that continues to get a response error 2000.
<qbmsxml>
<signonmsgsrq>
<signondesktoprq>
<clientdatetime>2014-04-03T09:37:23</clientdatetime>
<applicationlogin>my.application.login.id</applicationlogin>
<connectionticket>SDK-MY-Connection-Ticket</connectionticket>
<language>English</language>
<appid>9999999999</appid>
<appver>1.0</appver>
</signondesktoprq>
</signonmsgsrq>
<qbmsxmlmsgsrq>
<customercreditcardauthrq>
<transrequestid>140403937231</transrequestid>
<creditcardnumber>4111111111111111</creditcardnumber>
<expirationmonth>12</expirationmonth>
<expirationyear>2017</expirationyear>
<isecommerce>true</isecommerce>
<amount>0.01</amount>
<nameoncard>John Doe</nameoncard>
<creditcardaddress>1234 Main Street</creditcardaddress>
<creditcardpostalcode>12345</creditcardpostalcode>
</customercreditcardauthrq>
</qbmsxmlmsgsrq>
</qbmsxml>
As I've been reviewing the information on creating a request, I found an 'InstallationID' tag referenced. It goes in the element like so:
<signonmsgsrq>
<signondesktoprq>
<clientdatetime>2014-04-03T09:37:23</clientdatetime>
<applicationlogin>my.application.login.id</applicationlogin>
<connectionticket>SDK-MY-Connection-Ticket</connectionticket>
<installationid>IDTYPE</installationid>
<language>English</language>
<appid>9999999999</appid>
<appver>1.0</appver>
</signondesktoprq>
</signonmsgsrq>
My question is: What is the IDTYPE for InstallationID? Where can I get it? What options can I set it to?
I think the problem is not related to your InstallationID field at all. I think the problem is that your XML isn't conforming to what Intuit expects.
Specifically, everything in your XML request is lowercase, when Intuit expects it to be camel case. You're also missing a qbmsxml version header, and a xml version header.
Here's an example of a correctly formed request:
<?xml version="1.0" encoding="utf-8"?>
<?qbmsxml version="3.0"?>
<QBMSXML>
<SignonMsgsRq>
<SignonTicketRq>
<ClientDateTime>2009-10-09T13:14:16</ClientDateTime>
<SessionTicket>xxxxxxxxxxxxky4yL6eBtCULX1zgQ:106892184</SessionTicket>
</SignonTicketRq>
</SignonMsgsRq>
<QBMSXMLMsgsRq>
<CustomerCreditCardChargeRq>
<TransRequestID>35f9cf7cb20994e8a32e6b3e91e8e602</TransRequestID>
<CreditCardNumber>xxxxxxxxxxxx5100</CreditCardNumber>
<ExpirationMonth>10</ExpirationMonth>
<ExpirationYear>2009</ExpirationYear>
<Amount>295.00</Amount>
<NameOnCard>Keith Palmer</NameOnCard>
<CreditCardAddress>56 Cowles Road</CreditCardAddress>
<CreditCardPostalCode>06279</CreditCardPostalCode>
</CustomerCreditCardChargeRq>
</QBMSXMLMsgsRq>
</QBMSXML>
Where are you getting your syntax from? It seems very wrong... here are some good examples:
http://wiki.consolibyte.com/wiki/doku.php/quickbooks_qbms_integration

Retrieve a List of All Checks for an Account using qbXML

I'm working on a website for a client that integrates into QuickBook desktop. I need to get a listing of all the checks for a specific account (ideally I would like all transactions for that account [regardless of their type] but if I have to get them one at a time that's fine). When I send the following XML:
<ns1:sendRequestXMLResponse>
<ns1:sendRequestXMLResult>
<xml version="1.0" encoding="utf-8" ?>
<qbxml version="12.0"?>
<QBXML>
<QBXMLMsgsRq onError="stopOnError">
<CheckQueryRq>
<AccountFilter>
<ListID>800000F1-1362066981</ListID>
</AccountFilter>
<IncludeLineItems>true</IncludeLineItems>
</CheckQueryRq>
</QBXMLMsgsRq>
</QBXML>
</ns1:sendRequestXMLResult>
</ns1:sendRequestXMLResponse>
I receive the following error:
<CheckQueryRs statusCode="1" statusSeverity="Info" statusMessage="A query request did not find a matching object in QuickBooks" />
If I go into QuickBooks I can see there are checks associated with the account so I'm not sure why this doesn't return a result.
Update 1: I rewrote this without the AccountFilter so it returned every check and I found checkes with the 800000F1-1362066981 account. It's also 10 MB so it's really hard to work with. :-)