DocuSign API how to sync tags in template with Salesforce fields

我只是一个虾纸丫 提交于 2019-12-13 03:24:49

问题


I'm trying to send a document from a template using SOAP APi in Salesforce. I used the code walkthrough NDA kiosk as an example. I can pre-set the values but the value of the fields isn't written back to Salesforce. When I send the document from DocuSign button the values are synced as expected. // Add data for fields DocuSignAPI.TemplateReferenceFieldDataDataValue fd1 = new DocuSignAPI.TemplateReferenceFieldDataDataValue(); fd1.TabLabel = 'Full Name 1'; fd1.Value = recipient.UserName;

    ndaTemplate.FieldData = new DocuSignAPI.TemplateReferenceFieldData();
    ndaTemplate.FieldData.DataValues = new DocuSignAPI.ArrayOfTemplateReferenceFieldDataDataValue();
    ndaTemplate.FieldData.DataValues.DataValue = new DocuSignAPI.TemplateReferenceFieldDataDataValue[1];
    ndaTemplate.FieldData.DataValues.DataValue[0] = fd1;

//LINK THE Object with custom field

DocusignNetApi.CustomField field = new DocusignNetApi.CustomField (); 
        //field.Name = 'DSFSSourceObjectId'; 
        field.Name = '##SFCustom_Object__c'; 
        field.Value = pCustomObjectId;
        field.Show = 'false';
        DocusignNetApi.ArrayOfCustomField arrayOfCustomField = new DocusignNetApi.ArrayOfCustomField();
        arrayOfCustomField.CustomField  = new DocusignNetApi.CustomField[1];
        arrayOfCustomField.CustomField[0] = field;
        pEnvelopeInformation.CustomFields = arrayOfCustomField;

I do set external object ID in the custom fields and the envelope and recipient status are related to my custom object. I'm not really sure how to achieve what I want. Can someone refer me to a doc?


回答1:


I do not believe there is actual documentation on the process via the DS API, but you have it correct that you want the objectID to be an envelope custom field. The envelope custom field should be named "##SF{objectID}" so for an Opp it would be ##SFOpportunity.

You'll also need to map back the custom object to the custom field in Connect (via the DS web app), the screenshot is using Quotes, but it should be the same for any custom object.

Also if you want the DocuSign Status on that custom object instructions to map it back can be found here. I think the Status will come back properly despite being sent from the API as opposed to the DocuSign for Salesforce manage package.




回答2:


I found a better way. Thank you for your answer it lead me to a better solution. For anybody else who struggles with docusign API here is how to do it.
What we did so far was good. The problem with custom field is you can't reference it in custom button. So I wasn't able to see attachments directly on my custom object.
I changed the mapping to point to External Source Id instead of the custom field.
I sent a document with custom button from Salesforce and I used API explorer to get envelope assets - custom fields. This was the result. This is how SourceId from the button was mapped.

{
  "fieldId": "84508346",
  "name": "DSFSSourceObjectId",
  "show": "false",
  "required": "false",
  "value": "a2H11000001XXXX~My_Custom_Object__c"
},

I changed my code that created the custom field to contain the object name after the ID. Now I can see attachments when I send the document via API and from button click.
Enjoy all good people!



来源:https://stackoverflow.com/questions/35116843/docusign-api-how-to-sync-tags-in-template-with-salesforce-fields

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!