Docusign Send Multiple Envelope to multiple Signer with one to one Document to Signer mapping - salesforce

I have been working on Salesforce to Docusign Integration. I have multiple documents with Specific signer for each document i.e. one document should be send to one specific user, not all. But I want to do this in one Rest API call to docusign! The documents are stored in Accounts attachments which are created dynamically for each user which are specific to user.
I have been trying this using CompositeTemplates, what I am doing is, adding document and Signer in each inlineTemplate, But it is sending all the documents to all the users in sequence.
I don't want to show all document to all the user, they should see only document specific to them.
Below is the JSON which I am sending:
{
"status": "Sent",
"compositeTemplates": [
{
"inlineTemplates": [
{
"sequence": "1",
"recipients": {
"signers": [
{
"roleName": "Signer 1",
"recipientId": "1",
"name": "Anmol",
"email": "test#gmail.com"
}
]
},
"envelope": {
"status": "Sent",
"emailSubject": "test1"
},
"documents": [
{
"name": "Doc 1",
"fileExtension": "doc",
"documentId": "1",
"documentBase64": "JVBERi0xLjQKJeLjz9MKN58HkeCg8gJEomcWGJdEFtOYYklsXV2dlT6R6Owc+FXFMNSlpckKM6M/ioTGkROkEjkxBDrgthySkvMxGpQJYapHKWwcwXtRU9GCg=="
}
],
"customFields": {
"listCustomFields": [
{
"value": "00128000003tPKB",
"show": "true",
"required": "false",
"name": "Account",
"fieldId": "1",
"configurationType": "salesforce"
}
]
}
}
],
"compositeTemplateId": "1"
},
{
"inlineTemplates": [
{
"sequence": "1",
"recipients": {
"signers": [
{
"roleName": "Signer 2",
"recipientId": "1",
"name": "Anmol",
"email": "test1#gmail.com"
}
]
},
"envelope": {
"status": "Sent",
"emailSubject": "test2"
},
"documents": [
{
"name": "Doc 2",
"fileExtension": "doc",
"documentId": "2",
"documentBase64": "JVBERi0xLjYNJeLjz9MNCjEzIDAgb2JqDTw8L0xpbmVhcmlmDQoxMTYNCiUlRU9GDQo="
}
],
"customFields": {
"listCustomFields": [
{
"value": "00128000003tPKB",
"show": "true",
"required": "false",
"name": "Account",
"fieldId": "1",
"configurationType": "salesforce"
}
]
}
}
],
"compositeTemplateId": "2"
}
]
}
Any doc, code or suggestions about the approach I am following for this will be very helpful.

To do it in a single api call, specify the excludedDocuments property in the EnvelopeCreate request
excludedDocuments: Specifies the documents that are not visible to the recipient. Document Visibility must be enabled for the account and the enforceSignerVisibility property must be set to true for the envelope to use this.
Here is a sample Json for POST /v2/accounts/{accountId}/envelopes
Note: I have combined both your inline templates into a single inlineTemplate.
{
"status": "Sent",
"emailSubject": "Email Subject to all recipients",
"emailBlurb": "Email body to all recipients",
"compositeTemplates": [
{
"inlineTemplates": [
{
"sequence": "1",
"recipients": {
"signers": [
{
"recipientId": "1",
"name": "recipient one",
"email": "recipientone#dsxtr.com",
"excludedDocuments": [ "2" ]
},
{
"recipientId": "2",
"name": "recipient two",
"email": "recipienttwo#dsxtr.com",
"excludedDocuments": [ "1" ]
}
]
},
"documents": [
{
"name": "Doc 1",
"fileExtension": "doc",
"documentId": "1",
"documentBase64": ""
},
{
"name": "Doc 2",
"fileExtension": "doc",
"documentId": "2",
"documentBase64": ""
}
]
}
],
"compositeTemplateId": "1"
}
]
}

I believe you're looking for documentVisibility on the create envelope call.
There are other supporting documentVisibility endpoints here.

Related

In Azure Search how can I filter records that have tags with IDs matching any in a list

Given the following search index document schema:
{
"value": [
{
"Id": "abc",
"Name": "Some name",
"Tags": [
{
"Id": "123",
"Name": "Tag123"
},
{
"Id": "456",
"Name": "Tag456"
}
]
},
{
"Id": "xyz",
"Name": "Some name",
"Tags": [
{
"Id": "123",
"Name": "Tag123"
},
{
"Id": "789",
"Name": "Tag789"
}
]
},
]
}
What is the correct syntax for an OData query that will return all records with any Tag/Ids that are contained in input list?
The closest I have got is:
Tags/any(object: object/Id search.in ('123,456,789'))

how to combine parent and children from Solr nested documents

I'm new on lucence, solr queries, I have doubts about how to make a query to nested documents.
I have nested document indexed, as below
[
{
"id": "1",
"title": "Solr1",
"_childDocuments_": [
{
"id": "2",
"title": "Solr2",
"_childDocuments_": [
{
"id": "3",
"title": "Solr3",
"_childDocuments_": [
{
"id": "4",
"title": "SolrCloud supports it"
}
],
"something_else":"irrelevant"
}
],
"something_else":"irrelevant"
}
],
"something_else":"irrelevant"
},
{
"id": "5",
"title": Solr5",
"_childDocuments_": [
{
"id": "6",
"title": "SolrCloud here as well"
}
]
}
]
How do I search title:SolrCloud, and listed all children's parents? Such as
[
{
"id": "1",
"title": "Solr1",
"_childDocuments_": [
{
"id": "2",
"title": "Solr2",
"_childDocuments_": [
{
"id": "3",
"title": "Solr3",
"_childDocuments_": [
{
"id": "4",
"title": "SolrCloud supports it"
}
]
}
]
}
]
},
{
"id": "5",
"title": Solr5",
"_childDocuments_": [
{
"id": "6",
"title": "SolrCloud here as well"
}
]
}
]
which listed all parents of document 4(Sorl1, Solr2, Solr3) and document 6(Solr5).
And the depth of documents is not constants.
My current solution is that massaging data, add trace into original data, so I will know document come from. such as
[
{
"id": "1",
"title": "Solr1",
"_childDocuments_": [
{
"id": "2",
"title": "Solr2",
**"parent_id":"1",**
**"trace":"Solr1",**
"_childDocuments_": [
{
"id": "3",
"title": "Solr3",
**"parent_id":"2",**
**"trace":"Solr1/Solr2",**
"_childDocuments_": [
{
"id": "4",
"title": "SolrCloud supports it"
**"parent_id":"3",**
**"trace":"Solr1/Solr2/Solr3",**
}
],
"something_else":"irrelevant"
}
],
"something_else":"irrelevant"
}
],
"something_else":"irrelevant"
},
{
"id": "5",
"title": Solr5",
"_childDocuments_": [
{
"id": "6",
**"parent_id":"5",**
**"trace":"Solr5",**
"title": "SolrCloud here as well"
}
]
}
]
So after indexed, I could know who's parent document from result.
Could someone agree on this?
Looking for better solution than this.

Docusign Custom tags - formula tags

We are using Conga Composer to generate and send docs to customer (background mode) by adding DocuSign custom tags as integration parameters in the API call. we would want to add 3 days to the date signed value dynamically but formula tag is not supported in custom tags Documentation. Any thoughts how this can be achieved?
You will need a formula tag with the formula AddDays([DateSigned],3)
Here is a sample createEnvelope request.
POST /v2/accounts/{accountId}/envelopes
{
"emailSubject": "Please sign the agreement with two Date Tabs",
"status": "sent",
"recipients": {
"signers": [
{
"name": "Jane Doe",
"email": "JaneDoe#acme.com",
"recipientId": "1",
"tabs": {
"dateSignedTabs": [
{
"tabLabel": "ImportantDate",
"documentId": "1",
"pageNumber": "1",
"xPosition": "100",
"yPosition": "150"
}
],
"formulaTabs": [
{
"formula": "AddDays( [ImportantDate],3)",
"width": "100",
"documentId": "1",
"pageNumber": "1",
"xPosition": "300",
"yPosition": "150"
}
]
}
}
]
},
"documents": [
{
"documentId": "1",
"name": "Contract",
"fileExtension": "txt",
"documentBase64": "VGVzdCBEb2N1bWVudA=="
}
]
}
Docusign confirmed that this is not possible via anchor tags (custom tags).

DataTables - Load data from pre-defined JSON

I have a problem pointing dataTable to the right spot in the JSON. I receive a nested array:
{
"status": "ok",
"count": "7",
"msg ": "Operation Successful",
"data": [{
"contactHasServiceArea": true,
"issueCategories": [{
"id": "8",
"description": "Finance"
},
{
"id": "9",
"description": "Housing"
},
{
"id": "10",
"description": "International"
}
],
"cases": [{
"id": 31645,
"client_name": "Matthew",
"issue": "Assessment Completion",
"referral": null,
"opened_date": "10\/07\/2017",
"case_status": "Open"
}, {
"id": 31668,
"client_name": "Fanky ",
"issue": "Complex",
"referral": null,
"opened_date": "01\/07\/2017",
"case_status": "Open"
}]
}]
}
How do I point to the "cases" object? I'm sure this is simply, but I'm confused by the many options in the dataTables config.
I tried variations of data, dataSrc as well as data.cases or just cases, etc.
Thanks
$('#cases_table').DataTable( {
"ajax": "ajax/getCases",
"dataSrc" : "data.cases",
"data" : "cases",
"columns": [
{ "data": "client_name" },
{ "data": "issue" },
{ "data": "referral" },
{ "data": "opened_date" },
{ "data": "case_status" }
]
} );
You can configure like this:
$('#cases_table').DataTable( {
"ajax": {
"url": "ajax/getCases",
"dataSrc" : "data.cases"
},
"columns": [
{ "data": "client_name" },
{ "data": "issue" },
{ "data": "referral" },
{ "data": "opened_date" },
{ "data": "case_status" }
]
} );
datasrc points into the returns json. Remove the data option.

Create a specific json(Hash) from a csv using Ruby

I would appreciate any help trying to create a multi faceted CSV (with header) into a json I can use for a post. Here is csv and JSON format required. Ultimately; I need to create a single location that may have 1, 2, or many fax machines.
csv
ID,Location Name,timezone,code,display,address,city,state,postalcode,country,faxlocation,faxnumber,(in)active
5,Location1,America/Chicago,bu,Building,1313 Mocking Bird Lane,The City,IL,999999,USA,Room 1; Room 2,111111111; 2222222222,active
8,Location2,America/New_York,bu,Building,2626 Humpty Dumpty Lane,Another City,NY,999999,USA,Room 1; Room 2; Room 3,111111111; 2222222222; 3333333333,active
32,Location3,America/Los_Angeles,bu,Building,3939 Big Bird Lane,Last City,CA,999999,USA,Room 1,111111111,active
json
{
"resourceType": "Location",
"id": "5",
"description": "America/Chicago",
"name": "Location1",
"address": {
"address": "1313 Mocking Bird Lane",
"city": "The City",
"state": "IL",
"postalCode": "999999",
"country": "USA"
},
"telecom": [
{
"system": "fax",
"value": "1111111111",
"use": "work",
"extension": [
{
"url": "displayValue",
"valueString": "Room 1"
}
]
},
{
"system": "fax",
"value": "2222222222",
"use": "work",
"extension": [
{
"url": "displayValue",
"valueString": "Room "
}
]
}
],
"status": "active"
}
all requires here
locations = CSV.read(csv)
locations.shift # remove header row
locations.each_index do |index|
faxnumarrat = locations[index][10].to_s.delete(' ').split(';') #Take 10th index and turn it into an array
faxlocarray = locations[index][11].to_s.delete(' ').split(';') #Take 11th index and turn it into an array
# keys = ['loc1','loc2']
# values = ['fax1','fax2']
my_hash = Hash[faxnumarray.zip(faxlocarray)] # Combine locations and fax numbers
my_hash.each do |key, value|
#fax_hash = { 'system' => 'fax', 'value' => key, 'use' => 'work', 'extension' => [{ 'url' => 'automaticSend', 'valueBoolean' => false }, { 'url' => 'displayValue', 'valueString' => value }] } #Build up a hash using k,v. ISSUE: Only creates one fax. Need to put all faxes associated no matter how many per location
end
end
Instead of reading in the entire CSV as an array of arrays, you instead can open
or create a new CSV instance and pass in an option to convert the first line of
into headers into keys to access columns within a row more easily; e.g.
locations = CSV.open(csv, headers: true)
location = locations.first
# => #<CSV::Row "ID":"5" "Location Name":"Location1" "timezone":"America/Chicago" "code":"bu" "display":"Building" "address":"1313 Mocking Bird Lane" "city":"The City" "state":"IL" "postalcode":"999999" "country":"USA" "faxlocation":"Room 1; Room 2" "faxnumber":"111111111; 2222222222" "(in)active":"active">
location["Location Name"]
# => "Location1"
With the headers as keys we can use, we can then build a new Hash object using
those old values, whilst also build a collection they you had started in your
question example
locations = CSV.open(csv, headers: true)
results = locations.map.with_index do |location, index|
faxnumarray = location["faxnumber"].delete(' ').split(';') #Take 10th index and turn it into an array
faxlocarray = location["faxlocation"].delete(' ').split(';') #Take 11th index and turn it into an array
# keys = ['loc1','loc2']
# values = ['fax1','fax2']
my_hash = Hash[faxnumarray.zip(faxlocarray)] # Combine locations and fax numbers
{
"resourceType" => "Location",
"id" => location["ID"],
"description" => location["timezone"],
"name" => location["Location Name"],
"address" => {
"address" => location["address"],
"city" => location["city"],
"state" => location["state"],
"postalCode" => location["postalcode"],
"country" => location["country"]
},
"telecom" => my_hash.map do |key, value|
{
'system' => 'fax',
'value' => key,
'use' => 'work',
'extension' => [
{
'url' => 'automaticSend',
'valueBoolean' => false
},
{
'url' => 'displayValue',
'valueString' => value
}
]
}
end,
"status" => location["(in)active"]
}
end
results.to_json
I reused your code where I could and made the last object (the returned object)
within the map block resemble the requested Hash result object. Using map
instead of each means it
Returns a new array with the results of running block once for every element in enum.
-- Module: Enumerable (Ruby 2_4_0)
This produces the following result
[
{
"resourceType": "Location",
"id": "5",
"description": "America/Chicago",
"name": "Location1",
"address": {
"address": "1313 Mocking Bird Lane",
"city": "The City",
"state": "IL",
"postalCode": "999999",
"country": "USA"
},
"telecom": [
{
"system": "fax",
"value": "111111111",
"use": "work",
"extension": [
{
"url": "automaticSend",
"valueBoolean": false
},
{
"url": "displayValue",
"valueString": "Room 1"
}
]
},
{
"system": "fax",
"value": "2222222222",
"use": "work",
"extension": [
{
"url": "automaticSend",
"valueBoolean": false
},
{
"url": "displayValue",
"valueString": " Room 2"
}
]
}
],
"status": "active"
},
{
"resourceType": "Location",
"id": "8",
"description": "America/New_York",
"name": "Location2",
"address": {
"address": "2626 Humpty Dumpty Lane",
"city": "Another City",
"state": "NY",
"postalCode": "999999",
"country": "USA"
},
"telecom": [
{
"system": "fax",
"value": "111111111",
"use": "work",
"extension": [
{
"url": "automaticSend",
"valueBoolean": false
},
{
"url": "displayValue",
"valueString": "Room 1"
}
]
},
{
"system": "fax",
"value": "2222222222",
"use": "work",
"extension": [
{
"url": "automaticSend",
"valueBoolean": false
},
{
"url": "displayValue",
"valueString": " Room 2"
}
]
},
{
"system": "fax",
"value": "3333333333",
"use": "work",
"extension": [
{
"url": "automaticSend",
"valueBoolean": false
},
{
"url": "displayValue",
"valueString": " Room 3"
}
]
}
],
"status": "active"
},
{
"resourceType": "Location",
"id": "32",
"description": "America/Los_Angeles",
"name": "Location3",
"address": {
"address": "3939 Big Bird Lane",
"city": "Last City",
"state": "CA",
"postalCode": "999999",
"country": "USA"
},
"telecom": [
{
"system": "fax",
"value": "111111111",
"use": "work",
"extension": [
{
"url": "automaticSend",
"valueBoolean": false
},
{
"url": "displayValue",
"valueString": "Room 1"
}
]
}
],
"status": "active"
}
]
References:
Class: CSV (Ruby 2_4_0)

Resources