2014-02-20 32 views
0

使用SOAP API可以在我有多個收件人時使用不同的值預先填充信封內的標籤。一個例子是;我有2個收件人(或可能更多)和模板中的單個標籤/標籤(文本)。我希望這個標籤預先填入收件人的姓名,以便當他們收到時,收件人1將在文檔標籤上看到他/她的名字,收件人2將他/她的名字。DocuSign爲每個收件人預製選項卡值

我試着得到模板選項卡,並創建新的基於已經存在的值(主要是定位和類型等),我只是改變了值和收件人ID,並將這些選項卡添加到列表中。但是,無論何時更改選項卡的值/收件人ID,列表中的其他人都會更改。我通過將列表轉換爲數組並將信封選項卡設置爲新的選項卡陣列來最終完成此過程。

這裏是proccess:

newEnvelope.Tabs = GetTabs(newEnvelope); 

    private Tab[] GetTabs(Envelope envelope) { 

    Tab[] exsitingTabs = envelope.Tabs; 
    List<Tab> newTabs = new List<Tab>(); 

    foreach(Recipient r in envelope.Recipients) { 
     Tab tab = exsitingTabs .ElementAt(14); // Just a custom text tag 
     tab.RecipientID = r.ID; 
     tab.Value = r.UserName; 
     newTabs.Add(tab); //The older tab info gets replaced by the new tab info. 
          // all are still there, the old ones just have the same info 
          // as the latest added one 
    } 
    return newTabs.ToArray(); 
    } 

回答

0

是的,你絕對可以通過的DocuSign預填充用於多個收件人的標籤。嘗試爲收件人設置不同的TabLabel,這可能會解決重複問題。我認爲這可能是問題的原因是因爲當TabLabels是相同的,那麼這些字段會更新爲相同的值,但是如果它們不同,那麼它們將不會。

DocuSign SOAP API指南:

"Making custom tab’s TabLabel the same will cause the all like fields to update when the user enters data." 

因此,在你的循環只是試試這個:

foreach(Recipient r in envelope.Recipients) { 
    Tab tab = newTabs.ElementAt(14); // Just a custom text tag 
    tab.RecipientID = r.ID; 
    tab.Value = r.UserName; 

    tab.TabLabel = r.ID; // or some other unique value for each recipient 

    newTabs.Add(tab); //The older tab info gets replaced by the new tab info. 
         // all are still there, the old ones just have the same info 
         // as the latest added one 


} 
+0

感謝您的迅速響應。我已經嘗試過了,看起來它仍然在設置最新的值。順便說一句,我編輯舊的帖子,foreach循環中的新標籤應該是 – user3334271

+0

Tab tab = existingTabs.ElementAt(14); – user3334271

0

我想你可能會遇到的問題是,的DocuSign標籤是每個收件人,即它們是否分配給信封中的特定收件人(或收件人角色)?例如,如果您要發送貸款申請並擁有「簽名者1」和「簽名者2」,則需要有一個「簽名者名稱」字段來捕獲簽名者1的名稱,並且簽名者2需要具有「簽名者名字2」 (儘管FullSign字段由DocuSign在收件人簽名時自動填充)。你不會有一個「名稱」選項卡,然後嘗試用兩個不同的值填充它(這是你的代碼似乎在做什麼)。

您的代碼將可能看起來像什麼@Ergin上面寫道:

List<Tab> tabList = new List<Tab>(); 
Recipient[] recipients = newEnvelope.Recipients; 

foreach (Recipient r in recipients) 
{ 
    Tab tab = new Tab(); 
    tab.RecipientID = r.ID; 
    tab.TabLabel = string.Format("Recipient{0}Name", r.ID); 
    tab.Value = r.UserName; 
    tab.DocumentID = "1"; 

    tabList.Add(tab); 
} 

newEnvelope.Tabs = tabList.ToArray(); 

要獲取的名稱爲收件人#1,你的選項卡標籤將是「Recipient1Name」。

相關問題