2014-12-29 5 views
3

Docusign API 통합을 Salesforce에 사용하고 있습니다. 서명을 위해 Salesforce에서 Docusign API를 호출 한 후 문서에서 데이터 필드 태그를 업데이트해야한다는 요구 사항이 있습니다.Salesforce 데이터에서 Docusign의 데이터 필드 태그 업데이트

서명자의 라우팅 순서는 서명자 1에서 서명자 4까지입니다. 처음에는 해당 데이터 필드 태그의 값이 null이됩니다. 서명자 3이 서명을 완료 한 후 Salesforce에서 API 호출을 실행하고 Salesforce에서 객체의 맞춤 필드 값에서 가져온 값으로 태그를 업데이트해야합니다. 그러면 서명자 4는 문서에 서명하기 전에 데이터 필드 태그의 값을 볼 수 있습니다.

docusign의 Merge 필드를 사용하여 Salesforce 데이터를 해당 태그로 가져 왔습니다. 그러나 앞에서 말했듯이 초기 값은 null이됩니다 (병합 필드의 salesforce 데이터도 null이되므로) 서명 프로세스를 "중단"하고 태그를 업데이트 한 다음 서명자를 계속 남겨 두어야합니다.

데이터 필드 태그의 값이 업데이트되도록 봉투를 "새로 고칠 수있는 방법이 있습니까?

docusign은 봉투를 보낸 후 API 콜 아웃을 통해 Salesforce 데이터로 문서의 태그 값을 업데이트 할 수 있습니까?

Docusign RestAPI 가이드 Version2에서받는 사람 수정 탭 (태그)을 읽었습니다. 태그 유형이나 태그 값을 수정하기위한 것입니까?

+0

독창적 인 DocuSign for Salesforce 통합으로 원하는 작업을 수행 할 수있는 방법이 없습니다. API 또는 웹을 통해 문서를 수정하고 해당 값을 업데이트 할 수 있습니다. – Andrew

+0

@AndrewWilson에게 감사드립니다. 방금 했어. 봉투를 올바른 상태, 게시 태그 값, 게시 된 상태로 게시하십시오. 모두 RESTapi를 통해 완료되었습니다. –

+0

Hey @AndrewWilson, Docusign Restapi를 호출하여 "수정"상태로 봉투를 게시 할 때 반환되는 URL은 활성화하기 위해 브라우저에서 실행해야합니다. 그렇다면 태그 값을 업데이트 할 수있게되었습니다. 브라우저에 url을 보내고 apex에서 백그라운드로 실행하는 방법을 알고 있습니까? –

답변

4

세일즈 포스와 DS는 가능하지만 그 방식은 다릅니다. Send (Load) a URL to web browser and run it in background in APEX

병합 필드는 질문의 일부이지만 봉투가 성공적으로 완료되었을 때만 "SENT"및 업데이트 된 Salesforce 만 값으로 표시되므로 정말 문제가됩니다. 이 시나리오는 시나리오의 절반에 불과합니다.

다른 DocuSign 고객을 위해이 작업을 수행 한 예가 나와 있습니다. 그러나 DocuSign의 고급 워크 플로우 유형을 사용하는 경우 DocuSign의 관리자가 아닌 경우 DocuSign 계정 관리자에게 문의하십시오. 직업 서비스 그룹입니다.

1. Components added: 
    DocuSign Connect Object - dseRecipientConnectUpdate 
    custom Object - dseRecipientConnectUpdate__c​ 
    Trigger - dseRCU_AfterUpdate​ 
    Class - desController (in Sandbox and code below as well) 
    Class - CheckRecursive (in sandbox and code below as well) 
    DS Template Example -Agreement with ContractID 960BD14E-6A09-4A9E-89E6-77B1D8444B72 


2. What you need yet to do 
    Replace Send on Behalf user with Sender of envelope via code (hard Coded as [email protected] in code) lookup using envelopeID in DocuSign Status and get sender, then lookup in user that sender's email 
    Classify any stringified body's you want 
    Error Condition handling 
    Test Classes 
    Testing, Testing, testing 

How I tested: 
    0. Turn on debugging for API user and Myself 
    a. Sent Envelope from Template 
    b. Signed the first three recipients 
    c. Code updated the dseRecipientConnectUpdate__c​ record (a36) that was the autoresponse blocking user aka just changed record by editing but no real change, then save. 

    d. It would then fire trigger again (as mentioned you will need to change the send on behalf of user to automatically for final code to be sending user, but you can make it your email you send envelope by) and it will read recipients, get the contract id recipient and tab, add new recipient and tab with value, delete old reciepents (tag recipient and blocking) 

세일즈 포스 사용자 정의 개체 :

<?xml version="1.0" encoding="UTF-8"?> 
<CustomObject xmlns="http://soap.sforce.com/2006/04/metadata"> 
    <!--actionoverrides removed for sake of SO answer size/> 
    <compactLayoutAssignment>SYSTEM</compactLayoutAssignment> 
    <deploymentStatus>Deployed</deploymentStatus> 
    <description>DocuSign Recipient Connect Update</description> 
    <enableActivities>true</enableActivities> 
    <enableFeeds>false</enableFeeds> 
    <enableHistory>true</enableHistory> 
    <enableReports>true</enableReports> 
    <fields> 
     <fullName>RecipStatus__c</fullName> 
     <externalId>false</externalId> 
     <label>RecipStatus</label> 
     <length>50</length> 
     <required>false</required> 
     <trackHistory>false</trackHistory> 
     <trackTrending>false</trackTrending> 
     <type>Text</type> 
     <unique>false</unique> 
    </fields> 
    <fields> 
     <fullName>RecipientEmail__c</fullName> 
     <description>Recipient Email</description> 
     <externalId>false</externalId> 
     <label>RecipientEmail</label> 
     <required>false</required> 
     <trackHistory>false</trackHistory> 
     <trackTrending>false</trackTrending> 
     <type>Email</type> 
     <unique>false</unique> 
    </fields> 
    <fields> 
     <fullName>RecipientID__c</fullName> 
     <externalId>false</externalId> 
     <label>RecipientID</label> 
     <length>50</length> 
     <required>false</required> 
     <trackHistory>false</trackHistory> 
     <trackTrending>false</trackTrending> 
     <type>Text</type> 
     <unique>false</unique> 
    </fields> 
    <fields> 
     <fullName>dsEnvelopeID__c</fullName> 
     <description>dsfs__DocuSign_Envelope_ID__c</description> 
     <externalId>false</externalId> 
     <label>dsEnvelopeID</label> 
     <length>56</length> 
     <required>false</required> 
     <trackHistory>false</trackHistory> 
     <trackTrending>false</trackTrending> 
     <type>Text</type> 
     <unique>false</unique> 
    </fields> 
    <label>dseRecipientConnectUpdate</label> 
    <listViews> 
     <fullName>All</fullName> 
     <filterScope>Everything</filterScope> 
     <label>All</label> 
    </listViews> 
    <nameField> 
     <displayFormat>dseRCU-{0000000000}</displayFormat> 
     <label>dseRecipientConnectUpdate Name</label> 
     <trackHistory>false</trackHistory> 
     <type>AutoNumber</type> 
    </nameField> 
    <pluralLabel>dseRecipientConnectUpdates</pluralLabel> 
    <recordTypeTrackHistory>false</recordTypeTrackHistory> 
    <recordTypes> 
     <fullName>dseRecipientConnectUpdate</fullName> 
     <active>true</active> 
     <description>dseRecipientConnectUpdate</description> 
     <label>dseRecipientConnectUpdate</label> 
    </recordTypes> 
    <searchLayouts/> 
    <sharingModel>ReadWrite</sharingModel> 
</CustomObject> 

트리거 ==========

trigger dseRCU_AfterUpdate on dseRecipientConnectUpdate__c (after update) { 
    try 
    { 

     if (CheckRecursive.runOnce()) 
     { 

      List<dseRecipientConnectUpdate__c> myConnectUpdates = [Select d.dsEnvelopeID__c, d.RecipientID__c, d.RecipientEmail__c, d.RecipStatus__c, d.Id From dseRecipientConnectUpdate__c d WHERE Id IN:Trigger.newMap.keySet()]; 

      for(dseRecipientConnectUpdate__c myConnectCompleted :myConnectUpdates) 
      { 
       system.debug(myConnectCompleted.Id); 

       if(myConnectCompleted.RecipStatus__c.indexOf('AutoResponded') != -1) 
       { 
        system.debug(myConnectCompleted.RecipStatus__c); 
         //Looking for bounce back user via status AutoResponded and @accelrys.com emails/recipients 
         if(myConnectCompleted.RecipientEmail__c.indexOf('[email protected]') != -1) 
         { 
          //do modification to envelope here 
          dseController.updateEnvelope(myConnectCompleted.dsEnvelopeID__c, myConnectCompleted.RecipientID__c); 


         } 
       } 
      } 
     } 
    } 
    catch(Exception ex) 
    { 
     system.debug(ex); 
    } 
    finally 
    { 

    } 
} 

클래스 ====== ====

public with sharing class dseController { 

    public dseController() 
    { 

    } 

    public dseController(ApexPages.StandardController controller) 
    { 

    } 

    @future (callout=true) 
    public static void updateEnvelope(string envelopeID, string recipientID) 
    { 
    RecipientResponse RecipientResponseDeserialized = new RecipientResponse(); 
    RecipientTabResponse RecipientTabResponseDeserialized = new RecipientTabResponse(); 
    string rResponse = '{}'; 
    string recipientGuidwithContractTab; 
    string recipientGuidForBlockingRecipient; 
    string rTabResponse = '{}'; 
    string rSetRecipientResponse = '{}'; 
    string rSetTabForRecipientResponse = '{}'; 
    string rTabRecipientDeleteResponse = '{}'; 
    string rBlockingRecipientDeleteResponse = '{}'; 


    try 
    { 
//Call to get envelope recipients 
rResponse = getEnvelopeRecipients(envelopeID); 
system.debug(rResponse); 

RecipientResponseDeserialized = parseRecipentResponse(rResponse); 
system.debug(RecipientResponseDeserialized); 

recipientGuidwithContractTab = getRecipientwithContractTab(RecipientResponseDeserialized); 
system.debug(recipientGuidwithContractTab); 

//Call to get recipient tab 
rTabResponse = getRecipientTab(envelopeID, recipientGuidwithContractTab); 
system.debug(rTabResponse); 

RecipientTabResponseDeserialized = parseRecipientTabResponse(rTabResponse); 
system.debug(RecipientTabResponseDeserialized); 

//Call to add recipient with new id 
rSetRecipientResponse = setRecipientForNewTab(envelopeID,RecipientResponseDeserialized); 
system.debug(rSetRecipientResponse); 

//Call to add tab to new recipient with new id 

rSetTabForRecipientResponse = setNewTabforNewRecipient(envelopeID,RecipientTabResponseDeserialized); 
system.debug(rSetTabForRecipientResponse); 

//Call to delete old clone recipient 
rTabRecipientDeleteResponse = deleteRecipientTab(envelopeID, recipientGuidwithContractTab); 
system.debug(rTabRecipientDeleteResponse); 

//Call to delete blocking user 
recipientGuidForBlockingRecipient = getBlockingRecipient(RecipientResponseDeserialized); 
rBlockingRecipientDeleteResponse = deleteBlockingRecipient(envelopeID, recipientGuidForBlockingRecipient); 
system.debug(rBlockingRecipientDeleteResponse); 
    } 
catch(Exception ex) 
     { 
      system.debug(ex); 

     } 
     finally 
     { 

     }  

    } 

    public static string getRecipientwithContractTab(RecipientResponse rResponse) 
    { 
    string rContractTabID = 'Not Found'; 

    try{ 

    List<Signer> mySigners = rResponse.signers; 
    for(Signer mySigner : mySigners) 
    { 
    if(mySigner.roleName == 'ContractIDApprover') 
    { 
    rContractTabID = mySigner.recipientIdGuid; 
    } 

    } 

    } 
catch(Exception ex) 
     { 
      system.debug(ex); 

     } 
     finally 
     { 

     } 

     return rContractTabID; 

    } 

    public static string getBlockingRecipient(RecipientResponse rResponse) 
    { 
    string rContractTabID = 'Not Found'; 

    try{ 

    List<Signer> mySigners = rResponse.signers; 
    for(Signer mySigner : mySigners) 
    { 
    if(mySigner.roleName == 'BlockingUser') 
    { 
    rContractTabID = mySigner.recipientIdGuid; 
    } 

    } 

    } 
catch(Exception ex) 
     { 
      system.debug(ex); 

     } 
     finally 
     { 

     } 

     return rContractTabID; 

    } 


    public static string getEnvelopeRecipients(string envelopeID) 
    { 
    string response = '{}'; 
    string DSEndpoint = 'https://demo.docusign.net/restapi/v2/'; 
    string DSUserId = 'yourdsUserid'; 
    string DSPassword = 'yourdspassword'; 
    string DSAccountID = 'yourdsaccountID'; 
    string DSIntegratorKey = 'yourdsintegratorkey'; 


    try 
{ 

//FORCES that the DocuSign member has to be in the DocuSign account DSFS is configured for 
List<dsfs__DocuSignAccountConfiguration__c> dsAccountConfig = [Select d.dsfs__UseSendOnBehalfOf__c, d.dsfs__DocuSignBaseURL__c, d.dsfs__DSProSFUsername__c, d.dsfs__DSProSFPassword__c, d.dsfs__AccountId__c From dsfs__DocuSignAccountConfiguration__c d limit 1]; 

for(dsfs__DocuSignAccountConfiguration__c myConfig : dsAccountConfig) 
{ 

DSEndpoint = myConfig.dsfs__DocuSignBaseURL__c + 'restapi/v2/'; 
DSUserId = myConfig.dsfs__DSProSFUsername__c; 
DSPassword = myConfig.dsfs__DSProSFPassword__c; 

} 

HttpRequest request = new HttpRequest(); 
request.setEndpoint(DSEndpoint + 'accounts/'+DSAccountID+'/envelopes/'+envelopeID+'/recipients'); 
request.setMethod('GET'); 
request.setHeader('Content-Type', 'application/json'); 
request.setHeader('X-DocuSign-Authentication', '<DocuSignCredentials><Username>'+DSUserId+'</Username><Password>'+DSPassword+'</Password><IntegratorKey>'+DSIntegratorKey+'</IntegratorKey></DocuSignCredentials>'); 
request.setHeader('Accept', 'application/json'); 
request.setTimeout(120000); 

system.debug(request.getHeader('X-DocuSign-Authentication')); 


HttpResponse myResponse = (new Http()).send(request); 

system.debug(myResponse.getBody()); 

if(myResponse.getStatusCode().format()=='200') 
{ 
response = myResponse.getBody(); 
system.debug(response); 

} 

} 
catch(Exception ex) 
     { 
      system.debug(ex); 

     } 
     finally 
     { 

     } 

     return response; 
    } 

    public static string getRecipientTab(string envelopeID, string recipientGuid) 
    { 
    string response = '{}'; 
    string DSEndpoint = 'https://demo.docusign.net/restapi/v2/'; 
    string DSUserId = 'yourdsUserid'; 
    string DSPassword = 'yourdspassword'; 
    string DSAccountID = 'yourdsaccountID'; 
    string DSIntegratorKey = 'yourdsintegratorkey'; 


    try 
{ 

//FORCES that the DocuSign member has to be in the DocuSign account DSFS is configured for 
List<dsfs__DocuSignAccountConfiguration__c> dsAccountConfig = [Select d.dsfs__UseSendOnBehalfOf__c, d.dsfs__DocuSignBaseURL__c, d.dsfs__DSProSFUsername__c, d.dsfs__DSProSFPassword__c, d.dsfs__AccountId__c From dsfs__DocuSignAccountConfiguration__c d limit 1]; 

for(dsfs__DocuSignAccountConfiguration__c myConfig : dsAccountConfig) 
{ 

DSEndpoint = myConfig.dsfs__DocuSignBaseURL__c + 'restapi/v2/'; 
DSUserId = myConfig.dsfs__DSProSFUsername__c; 
DSPassword = myConfig.dsfs__DSProSFPassword__c; 

} 

HttpRequest request = new HttpRequest(); 
request.setEndpoint(DSEndpoint + 'accounts/'+DSAccountID+'/envelopes/'+envelopeID+'/recipients/'+recipientGuid+'/tabs/'); 
request.setMethod('GET'); 
request.setHeader('Content-Type', 'application/json'); 
request.setHeader('X-DocuSign-Authentication', '<DocuSignCredentials><Username>'+DSUserId+'</Username><Password>'+DSPassword+'</Password><SendOnBehalfOf>[email protected]</SendOnBehalfOf><IntegratorKey>'+DSIntegratorKey+'</IntegratorKey></DocuSignCredentials>'); 
request.setHeader('Accept', 'application/json'); 
request.setTimeout(120000); 

system.debug(request.getHeader('X-DocuSign-Authentication')); 


HttpResponse myResponse = (new Http()).send(request); 

system.debug(myResponse.getBody()); 

if(myResponse.getStatusCode().format()=='200') 
{ 
response = myResponse.getBody(); 
system.debug(response); 

} 

} 
catch(Exception ex) 
     { 
      system.debug(ex); 

     } 
     finally 
     { 

     } 

     return response; 
    } 

    public static string setRecipientForNewTab(string envelopeID, RecipientResponse rResponse) 
    { 
    string response = '{}'; 
    string DSEndpoint = 'https://demo.docusign.net/restapi/v2/'; 
    string DSUserId = 'yourdsUserid'; 
    string DSPassword = 'yourdspassword'; 
    string DSAccountID = 'yourdsaccountID'; 
    string DSIntegratorKey = 'yourdsintegratorkey'; 


    try 
{ 

//FORCES that the DocuSign member has to be in the DocuSign account DSFS is configured for 
List<dsfs__DocuSignAccountConfiguration__c> dsAccountConfig = [Select d.dsfs__UseSendOnBehalfOf__c, d.dsfs__DocuSignBaseURL__c, d.dsfs__DSProSFUsername__c, d.dsfs__DSProSFPassword__c, d.dsfs__AccountId__c From dsfs__DocuSignAccountConfiguration__c d limit 1]; 

for(dsfs__DocuSignAccountConfiguration__c myConfig : dsAccountConfig) 
{ 

DSEndpoint = myConfig.dsfs__DocuSignBaseURL__c + 'restapi/v2/'; 
DSUserId = myConfig.dsfs__DSProSFUsername__c; 
DSPassword = myConfig.dsfs__DSProSFPassword__c; 

} 

Signer mySignerToAdd = new Signer(); 

List<Signer> mySigners = rResponse.signers; 
    for(Signer mySigner : mySigners) 
    { 
    if(mySigner.roleName == 'ContractIDApprover') 
    { 
    mySignerToAdd = mySigner; 
    } 

    } 


    String myBody; 
    myBody = '{"signers": [{"signInEachLocation": "false","name": "'+mySignerToAdd.name +'Added 1","email": "'+mySignerToAdd.email+'","recipientId": "7","requireIdLookup": "false","routingOrder": "19","roleName": "'+mySignerToAdd.roleName+'1"}]}'; 

HttpRequest request = new HttpRequest(); 
request.setEndpoint(DSEndpoint + 'accounts/'+DSAccountID+'/envelopes/'+envelopeID+'/recipients/'); 
request.setMethod('POST'); 
request.setHeader('Content-Type', 'application/json'); 
request.setHeader('X-DocuSign-Authentication', '<DocuSignCredentials><Username>'+DSUserId+'</Username><Password>'+DSPassword+'</Password><SendOnBehalfOf>[email protected]</SendOnBehalfOf><IntegratorKey>'+DSIntegratorKey+'</IntegratorKey></DocuSignCredentials>'); 
request.setHeader('Accept', 'application/json'); 
request.setTimeout(120000); 
request.setBody(myBody); 

system.debug(request.getHeader('X-DocuSign-Authentication')); 


HttpResponse myResponse = (new Http()).send(request); 

system.debug(myResponse.getBody()); 

if(myResponse.getStatusCode().format()=='201') 
{ 
response = myResponse.getBody(); 
system.debug(response); 

} 

} 
catch(Exception ex) 
     { 
      system.debug(ex); 

     } 
     finally 
     { 

     } 

     return response; 
    } 

    public static string setNewTabforNewRecipient(string envelopeID, RecipientTabResponse rTabResponse) 
    { 
    string response = '{}'; 
    string DSEndpoint = 'https://demo.docusign.net/restapi/v2/'; 
    string DSUserId = 'yourdsUserid'; 
    string DSPassword = 'yourdspassword'; 
    string DSAccountID = 'yourdsaccountID'; 
    string DSIntegratorKey = 'yourdsintegratorkey'; 


    try 
{ 

//FORCES that the DocuSign member has to be in the DocuSign account DSFS is configured for 
List<dsfs__DocuSignAccountConfiguration__c> dsAccountConfig = [Select d.dsfs__UseSendOnBehalfOf__c, d.dsfs__DocuSignBaseURL__c, d.dsfs__DSProSFUsername__c, d.dsfs__DSProSFPassword__c, d.dsfs__AccountId__c From dsfs__DocuSignAccountConfiguration__c d limit 1]; 

for(dsfs__DocuSignAccountConfiguration__c myConfig : dsAccountConfig) 
{ 

DSEndpoint = myConfig.dsfs__DocuSignBaseURL__c + 'restapi/v2/'; 
DSUserId = myConfig.dsfs__DSProSFUsername__c; 
DSPassword = myConfig.dsfs__DSProSFPassword__c; 

} 

TextTabs myTextTabToAdd = new TextTabs(); 

List<TextTabs> myTextTabs = rTabResponse.textTabs; 
    for(TextTabs myTextTab : myTextTabs) 
    { 
    if(myTextTab.tabLabel == 'ContractID') 
    { 
    myTextTabToAdd = myTextTab; 
    } 

    } 


    String myBody; 
    myBody = '{"textTabs": [{"height": '+myTextTabToAdd.height+',"shared": "'+myTextTabToAdd.shared+'","requireInitialOnSharedChange": "'+myTextTabToAdd.requireInitialOnSharedChange+'","name": "'+myTextTabToAdd.name+'1","value": "ContractID12345","width": '+myTextTabToAdd.width+',"required": "'+myTextTabToAdd.required+'","locked": "'+myTextTabToAdd.locked+'","concealValueOnDocument": "'+myTextTabToAdd.concealValueOnDocument+'","disableAutoSize": "'+myTextTabToAdd.disableAutoSize+'","tabLabel": "'+myTextTabToAdd.tabLabel+'","documentId": "'+myTextTabToAdd.documentId+'","recipientId": "7","pageNumber": "'+myTextTabToAdd.pageNumber+'","xPosition": "'+myTextTabToAdd.xPosition+'","yPosition": "'+myTextTabToAdd.yPosition+'"}]}'; 

HttpRequest request = new HttpRequest(); 
request.setEndpoint(DSEndpoint + 'accounts/'+DSAccountID+'/envelopes/'+envelopeID+'/recipients/7/tabs'); 
request.setMethod('POST'); 
request.setHeader('Content-Type', 'application/json'); 
request.setHeader('X-DocuSign-Authentication', '<DocuSignCredentials><Username>'+DSUserId+'</Username><Password>'+DSPassword+'</Password><SendOnBehalfOf>[email protected]</SendOnBehalfOf><IntegratorKey>'+DSIntegratorKey+'</IntegratorKey></DocuSignCredentials>'); 
request.setHeader('Accept', 'application/json'); 
request.setTimeout(120000); 
request.setBody(myBody); 

system.debug(request.getHeader('X-DocuSign-Authentication')); 


HttpResponse myResponse = (new Http()).send(request); 

system.debug(myResponse.getBody()); 

if(myResponse.getStatusCode().format()=='201') 
{ 
response = myResponse.getBody(); 
system.debug(response); 

} 

} 
catch(Exception ex) 
     { 
      system.debug(ex); 

     } 
     finally 
     { 

     } 

     return response; 
    } 

    public static string deleteRecipientTab(string envelopeID, string recipientGuid) 
    { 
    string response = '{}'; 
    string DSEndpoint = 'https://demo.docusign.net/restapi/v2/'; 
    string DSUserId = 'yourdsUserid'; 
    string DSPassword = 'yourdspassword'; 
    string DSAccountID = 'yourdsaccountID'; 
    string DSIntegratorKey = 'yourdsintegratorkey'; 


    try 
{ 

//FORCES that the DocuSign member has to be in the DocuSign account DSFS is configured for 
List<dsfs__DocuSignAccountConfiguration__c> dsAccountConfig = [Select d.dsfs__UseSendOnBehalfOf__c, d.dsfs__DocuSignBaseURL__c, d.dsfs__DSProSFUsername__c, d.dsfs__DSProSFPassword__c, d.dsfs__AccountId__c From dsfs__DocuSignAccountConfiguration__c d limit 1]; 

for(dsfs__DocuSignAccountConfiguration__c myConfig : dsAccountConfig) 
{ 

DSEndpoint = myConfig.dsfs__DocuSignBaseURL__c + 'restapi/v2/'; 
DSUserId = myConfig.dsfs__DSProSFUsername__c; 
DSPassword = myConfig.dsfs__DSProSFPassword__c; 

} 

HttpRequest request = new HttpRequest(); 
request.setEndpoint(DSEndpoint + 'accounts/'+DSAccountID+'/envelopes/'+envelopeID+'/recipients/'+recipientGuid); 
request.setMethod('DELETE'); 
request.setHeader('Content-Type', 'application/json'); 
request.setHeader('X-DocuSign-Authentication', '<DocuSignCredentials><Username>'+DSUserId+'</Username><Password>'+DSPassword+'</Password><SendOnBehalfOf>[email protected]</SendOnBehalfOf><IntegratorKey>'+DSIntegratorKey+'</IntegratorKey></DocuSignCredentials>'); 
request.setHeader('Accept', 'application/json'); 
request.setTimeout(120000); 

system.debug(request.getHeader('X-DocuSign-Authentication')); 


HttpResponse myResponse = (new Http()).send(request); 

system.debug(myResponse.getBody()); 

if(myResponse.getStatusCode().format()=='200') 
{ 
response = myResponse.getBody(); 
system.debug(response); 

} 

} 
catch(Exception ex) 
     { 
      system.debug(ex); 

     } 
     finally 
     { 

     } 

     return response; 
    } 

     public static string deleteBlockingRecipient(string envelopeID, string recipientGuid) 
    { 
    string response = '{}'; 
    string DSEndpoint = 'https://demo.docusign.net/restapi/v2/'; 
    string DSUserId = 'yourdsUserid'; 
    string DSPassword = 'yourdspassword'; 
    string DSAccountID = 'yourdsaccountID'; 
    string DSIntegratorKey = 'yourdsintegratorkey'; 


    try 
{ 

//FORCES that the DocuSign member has to be in the DocuSign account DSFS is configured for 
List<dsfs__DocuSignAccountConfiguration__c> dsAccountConfig = [Select d.dsfs__UseSendOnBehalfOf__c, d.dsfs__DocuSignBaseURL__c, d.dsfs__DSProSFUsername__c, d.dsfs__DSProSFPassword__c, d.dsfs__AccountId__c From dsfs__DocuSignAccountConfiguration__c d limit 1]; 

for(dsfs__DocuSignAccountConfiguration__c myConfig : dsAccountConfig) 
{ 

DSEndpoint = myConfig.dsfs__DocuSignBaseURL__c + 'restapi/v2/'; 
DSUserId = myConfig.dsfs__DSProSFUsername__c; 
DSPassword = myConfig.dsfs__DSProSFPassword__c; 

} 

HttpRequest request = new HttpRequest(); 
request.setEndpoint(DSEndpoint + 'accounts/'+DSAccountID+'/envelopes/'+envelopeID+'/recipients/'+recipientGuid); 
request.setMethod('DELETE'); 
request.setHeader('Content-Type', 'application/json'); 
request.setHeader('X-DocuSign-Authentication', '<DocuSignCredentials><Username>'+DSUserId+'</Username><Password>'+DSPassword+'</Password><SendOnBehalfOf>[email protected]</SendOnBehalfOf><IntegratorKey>'+DSIntegratorKey+'</IntegratorKey></DocuSignCredentials>'); 
request.setHeader('Accept', 'application/json'); 
request.setTimeout(120000); 

system.debug(request.getHeader('X-DocuSign-Authentication')); 


HttpResponse myResponse = (new Http()).send(request); 

system.debug(myResponse.getBody()); 

if(myResponse.getStatusCode().format()=='200') 
{ 
response = myResponse.getBody(); 
system.debug(response); 

} 

} 
catch(Exception ex) 
     { 
      system.debug(ex); 

     } 
     finally 
     { 

     } 

     return response; 
    }  

public static RecipientResponse parseRecipentResponse(String json) { 
return (RecipientResponse) System.JSON.deserialize(json, RecipientResponse.class); 
} 

public static RecipientTabResponse parseRecipientTabResponse(String json) { 
return (RecipientTabResponse) System.JSON.deserialize(json, RecipientTabResponse.class); 
} 
    public class Signer 
    { 
    public string name; 
    public string email; 
    public string recipientId; 
    public string recipientIdGuid; 
    public string requireIdLookup; 
    public string userId; 
    public string routingOrder; 
    public string roleName; 
    public string status; 
    public string signedDateTime; 
    public string deliveredDateTime; 
    public string templateLocked; 
    public string templateRequired; 

    } 

    public class RecipientResponse 
    { 
    public List<Signer> signers; 
    public List<Signer> agents; 
    public List<Signer> editors; 
    public List<Signer> intermediaries; 
    public List<Signer> carbonCopies; 
    public List<Signer> certifiedDeliveries; 
    public List<Signer> inPersonSigners; 
    public String recipientCount; 
    public String currentRoutingOrder; 


    } 

public class TextTabs { 
public Integer height; 
public String validationPattern; 
public String validationMessage; 
public String shared; 
public String requireInitialOnSharedChange; 
public String name; 
public String value; 
public Integer width; 
public String required; 
public String locked; 
public String concealValueOnDocument; 
public String disableAutoSize; 
public String tabLabel; 
public String documentId; 
public String recipientId; 
public String pageNumber; 
public String xPosition; 
public String yPosition; 
public String tabId; 
} 

public class RecipientTabResponse 
{ 
public List<TextTabs> textTabs; 



} 



} 
+0

응답 해 주셔서 감사합니다. 확실히 그 코드를 참조로 사용 하겠지만 docusign은 수정 URL을 실행하여 REST API GET 요청을 통해 "교정"상태로 봉투를 게시 할 수 없으며 다른 게시물에 응답 한 PUT 요청은 봉투를 보내면 데이터 필드 태그를 업데이트 할 수 없습니다. 봉투를 보내거나받은 후 수정 모드로 봉투를 설정하지 않고 봉투에서 데이터 필드 태그를 업데이트하는 방법을 제안 해 주시겠습니까? –

+0

먼저 우리는 현재 잠금 (Furture)을 가지고 있지 않으므로받는 사람 (Add, Update, Delete)에 대한 봉투를 변경하면 "Correct"상태가됩니다. UI와 수정으로 끝날 때까지 현재 상태에서 올바른 상태로 유지됩니다. 현재 UI를 통해 사용할 수 없습니다. 따라서 99와 같은 라우팅 순서에서 차단 사용자와 함께 봉투를 보내고받는 사람 100은 원래 값을 가진 사용자이며 차단 된 값을 가진받는 사람 100 태그를 읽고 라우팅 순서 98에서 동일한받는 사람을 추가하고받는 사람을 삭제합니다 100 및 99. –

+0

코드의 주석은이 문제를 해결하기 위해 코드를 이해하는 것이 중요하며 다시 이와 같은 고급 워크 플로를 권장합니다. DocuSign 계정 관리자에게 문의하여 ProServ와 계약을 체결하십시오. 유료 API 지원 유형을 사용하면 프로젝트를보다 빨리 완료하고 DocuSign API를 효과적으로 사용하는 데 필요한 통찰력을 얻을 수 있습니다. 우리는 이제 Amazon Kindle에서 3 달러 미만의 가격으로 구입할 수있는 실험실을 기반으로 한 새로운 인증 및 강의를 가지게되었습니다. 그 중 하나는 정확합니다. http://blog.grigsbyconsulting.com/?p=281 –