I am a beginner in DocuSign API programming. I have a .cshtml
page for create envelope for sending to customer. When I try to create envelop from DocuSign API it shows error message like:
Page number not specified in tab element. Page Number or AnchorTabItem missing for tab \"SignHere\"."
Please see my HTML and code below.
Html
<span>
<br />
<br />
<span><b>SIGNATURE:</b></span> <span style="color:white;">pleasesignhereBP</span>
<br />
<br />
<span><b>DATE:</b></span><span style="color:white;">pleasedatehereBP</span>
<br />
<br />
</span>
Code
SignerModel objPerson = new SignerModel();
TabsModel objPersonTab = new TabsModel();
List<SignHereModel> lstPersonSignHere = new List<SignHereModel>();
SignHereModel objPersonSignHere = new SignHereModel();
objPersonSignHere.DocumentId = "1";
objPersonSignHere.PageNumber = "1";
objPersonSignHere.RecipientId = "2";
objPersonSignHere.AnchorString = "pleasesignhereBP";
objPersonSignHere.AnchorXOffset = ".2";
objPersonSignHere.AnchorYOffset = ".01";
objPersonSignHere.AnchorIgnoreIfNotPresent = "true";
objPersonSignHere.AnchorUnits = "cms";
lstPersonSignHere.Add(objPersonSignHere);
objPersonTab.SignHereTabs = lstPersonSignHere;
List<DateModel> lstPersonDateHere = new List<DateModel>();
DateModel objPersonDate = new DateModel();
objPersonDate.DocumentId = "1";
objPersonDate.PageNumber = "1";
objPersonDate.RecipientId = "1";
objPersonDate.AnchorString = "pleasedatehereBP";
objPersonDate.AnchorXOffset = ".2";
objPersonDate.AnchorYOffset = ".01";
objPersonDate.AnchorIgnoreIfNotPresent = "true";
objPersonDate.AnchorUnits = "cms";
objPersonDate.Value = DateTime.Now.ToShortDateString();
lstPersonDateHere.Add(objPersonDate);
objPersonTab.DateTabs = lstPersonDateHere;
objPerson.Tabs = objPersonTab;
I already added the objPersonDate.PageNumber = "1" but it's not working.
Updates
I have DocuSign.eSign library in my project solution. I refer this project my webapplication. Then i do some changes in the SetDocuSignSigners
function of DocuSignCommunicator
class.
objSHere.PageNumber = (!string.IsNullOrEmpty(objSHere.PageNumber)) ? objSHere.PageNumber : "1";
Please see my detailed code below.
private List<Signer> SetDocuSignSigners(List<SignerModel> lstSignerModel)
{
List<Signer> lstSigner = new List<Signer>();
if (lstSignerModel != null && lstSignerModel.Count > 0)
{
foreach (SignerModel objModel in lstSignerModel)
{
Signer objSigner = new Signer();
objSigner.Name = objModel.Name;
objSigner.Email = objModel.Email;
objSigner.RecipientId = objModel.RecipientId;
objSigner.RoutingOrder = objModel.RoutingOrder;
Tabs objTab = new Tabs();
List<SignHere> lstSalesSignHere = new List<SignHere>();
List<DateSigned> lstSalesDateHere = new List<DateSigned>();
List<FullName> lstSalesNameHere = new List<FullName>();
if (objModel.Tabs != null)
{
if (objModel.Tabs.SignHereTabs != null && objModel.Tabs.SignHereTabs.Count > 0)
{
foreach (SignHereModel objSignHere in objModel.Tabs.SignHereTabs)
{
SignHere objSHere = new Model.SignHere();
objSHere.PageNumber = (!string.IsNullOrEmpty(objSHere.PageNumber)) ? objSHere.PageNumber : "1";
objSHere.AnchorString = objSignHere.AnchorString;
objSHere.DocumentId = objSignHere.DocumentId;
objSHere.RecipientId = objSignHere.RecipientId;
objSHere.AnchorXOffset = objSignHere.AnchorXOffset;
objSHere.AnchorYOffset = objSignHere.AnchorYOffset;
objSHere.AnchorUnits = objSignHere.AnchorUnits;
objSHere.AnchorIgnoreIfNotPresent = objSignHere.AnchorIgnoreIfNotPresent;
objSHere.AnchorMatchWholeWord = "true";
lstSalesSignHere.Add(objSHere);
}
}
if (objModel.Tabs.DateTabs != null && objModel.Tabs.DateTabs.Count > 0)
{
foreach (DateModel objDateHere in objModel.Tabs.DateTabs)
{
DateSigned objDSHere = new DateSigned();
objDSHere.PageNumber = (!string.IsNullOrEmpty(objDSHere.PageNumber)) ? objDSHere.PageNumber : "1";
objDSHere.AnchorString = objDateHere.AnchorString;
objDSHere.DocumentId = objDateHere.DocumentId;
objDSHere.RecipientId = objDateHere.RecipientId;
objDSHere.AnchorXOffset = objDateHere.AnchorXOffset;
objDSHere.AnchorYOffset = objDateHere.AnchorYOffset;
objDSHere.AnchorUnits = objDateHere.AnchorUnits;
objDSHere.AnchorIgnoreIfNotPresent = objDateHere.AnchorIgnoreIfNotPresent;
objDSHere.AnchorMatchWholeWord = "true";
////objDSHere.Value = objDateHere.Value;
lstSalesDateHere.Add(objDSHere);
}
}
if (objModel.Tabs.FullNameTabs != null && objModel.Tabs.FullNameTabs.Count > 0)
{
foreach (FullNameModel objDateHere in objModel.Tabs.FullNameTabs)
{
FullName objNameHere = new FullName();
objNameHere.PageNumber = (!string.IsNullOrEmpty(objNameHere.PageNumber)) ? objNameHere.PageNumber : "1";
objNameHere.AnchorString = objDateHere.AnchorString;
objNameHere.DocumentId = objDateHere.DocumentId;
objNameHere.RecipientId = objDateHere.RecipientId;
objNameHere.AnchorXOffset = objDateHere.AnchorXOffset;
objNameHere.AnchorYOffset = objDateHere.AnchorYOffset;
objNameHere.AnchorUnits = objDateHere.AnchorUnits;
objNameHere.AnchorIgnoreIfNotPresent = objDateHere.AnchorIgnoreIfNotPresent;
objNameHere.Value = objDateHere.Value;
objNameHere.AnchorMatchWholeWord = "true";
lstSalesNameHere.Add(objNameHere);
}
}
}
objTab.SignHereTabs = lstSalesSignHere;
objTab.DateSignedTabs = lstSalesDateHere;
objTab.FullNameTabs = lstSalesNameHere;
objSigner.Tabs = objTab;
lstSigner.Add(objSigner);
}
}
return lstSigner;
}
I don't know this is a best practice but my issue is solved. Please advice if this is not a good practice.
After the library change
Sadly it's not working in the signature placement in documents. I have two fields in my document Signature and Signaturedate but these fields are placed in wrong placement when I signed the document via DocuSign website. Please see the document below.
So assign page number is not a solution for my issue.
Please update above with actual code change, because with what you are showing and what you "Say" below it seems in conflict.
It looks like you are missing the "TabId" aka "Tab Item"
"name": "sample string 1",
"tabLabel": "sample string 2",
"scaleValue": 3.1,
"optional": "sample string 4",
"documentId": "sample string 5",
"recipientId": "sample string 6",
"pageNumber": "sample string 7",
"xPosition": "sample string 8",
"yPosition": "sample string 9",
"anchorString": "sample string 10",
"anchorXOffset": "sample string 11",
"anchorYOffset": "sample string 12",
"anchorUnits": "sample string 13",
"anchorIgnoreIfNotPresent": "sample string 14",
"tabId": "sample string 15",
"conditionalParentLabel": "sample string 16",
"conditionalParentValue": "sample string 17"
https://www.docusign.net/restapi/help
I really suggest using PostMan Client and / or SoapUI to validate you can make your api call, especially in the beginning. This way you can see the actual error returned, as it will say more about the error in the response for very common mistakes. PostMan or SoapUI will issue the actual API calls successfully (Demo or Prod once you have passed prod API certification) showing you the actual response without having to worry about coding typo's, properties of objects or debugging logging to see what really came back.
This allows you to learn the DocuSign API while using your choice of SDK. You did the right thing asking for help here on Stack Overflow.
I have a couple links for you to get started:
DocuSign Developer Center where you probably found the PHP SDK https://developers.docusign.com/esign-rest-api/sdk-tools
Link for info on PostMan (older version, you can get the latest one - aka Orange Rocket Man logo vs blue world, for Chrome or Mac Standalone - https://blog.grigsbyconsultingllc.com/postman-rest-client-a-google-chrome-app/
X-DocuSign-Authentication Header Q&A on StackOverflow How should the header X-DocuSign-Authentication be used for REST and SOAP?
I like the concept of the DocuSign API explorer to start with, sad part is it doesn't work against prod, so you still have to use something else when you move from demo to prod.
And as mention above by "Amit K Bist" you can you capture exact JSON request posted your PHP | API calls by following steps explained at this DocuSign support article https://support.docusign.com/guides/ndse-user-guide-api-request-logging
Best of Luck and Enjoy your DocuSign API journey!
来源:https://stackoverflow.com/questions/49447151/error-calling-createenvelope-tab-page-number-not-specified