robinlu

How to Access Document Fields - Fields count is 0.

0 votes
I'm trying to pull down completed packages and read the fields. None of my documents have the fields array populated. The fields were created from an existing fillablePDF using the API to create the template.
 CompletionReport sdkCompletionReport = eslClient.ReportService.DownloadCompletionReport(DocumentPackageStatus.COMPLETED, DateTime.MinValue, DateTime.MaxValue);

 foreach (SenderCompletionReport senderCompletionReport in sdkCompletionReport.Senders)
                {
                    foreach (PackageCompletionReport packageCompletionReport in senderCompletionReport.Packages)
                    {
                        DocumentPackage pkg = eslClient.GetPackage(new PackageId(packageCompletionReport.Id));

                        Document d = pkg.Documents[1]; // no fields in d.Fields
...

Reply to: How to Access Document Fields - Fields count is 0.

0 votes
Hi Robin, You will have to use the FieldSummaryService in order to retrieve the field values.
CompletionReport sdkCompletionReport = eslClient.ReportService.DownloadCompletionReport(DocumentPackageStatus.COMPLETED, DateTime.Now.AddDays(-5), DateTime.Now.AddDays(5));

foreach (SenderCompletionReport senderCompletionReport in sdkCompletionReport.Senders)
{
    foreach (PackageCompletionReport packageCompletionReport in senderCompletionReport.Packages)
    {
        List fieldSummaries = eslClient.FieldSummaryService.GetFieldSummary(new PackageId(packageCompletionReport.Id));

        Debug.WriteLine("SignerId || DocumentId || FieldId: Value");

        foreach (FieldSummary fieldSummary in fieldSummaries)
        {
            Debug.WriteLine(fieldSummary.SignerId + " || " + fieldSummary.DocumentId + " || " +
                fieldSummary.FieldId + ": " + fieldSummary.FieldValue);
        }
    }
}
Haris Haidary OneSpan Technical Consultant

Hello! Looks like you're enjoying the discussion, but haven't signed up for an account.

When you create an account, we remember exactly what you've read, so you always come right back where you left off