DocuSign Request error "Envelope definition missing." - salesforce

I am trying to make 'createAndSendEnvelope' request using DocuSign REST api/v2. My JSON is valid.
I came across the same question and I tried the solution given in there i.e. I made sure all new lines use '\r\n'.
What am I missing here? Here is my request, I get error code, "message": "The Envelope is not Complete. A Complete Envelope Requires Documents, Recipients, Tabs, and a Subject Line. Envelope definition missing."
POST https://demo.docusign.net/restapi/v2/accounts/xxxxx/envelopes HTTP/1.1
X-DocuSign-Authentication: {"Username":"xxxxxx","Password":"xxxxx","IntegratorKey":"xxxxxx"}
Content-Type: multipart/form-data; boundary=AAA
Accept: application/json
Host: demo.docusign.net
Content-Length: 90500
Expect: 100-continue
--AAA
Content-Type: application/json
Content-Disposition: form-data
{
"status": "sent",
"recipients": {
"signers": [{
"tabs": {
"signHeretabs": [{
"yPosition": "15",
"xPosition": "249",
"width": "100",
"tablabel": null,
"required": "TRUE",
"recipientId": "1",
"pagenumber": "1",
"fontSize": "Size12",
"font": "Calibri",
"documentid": "1",
"anchorYoffset": null,
"anchorXOffset": null,
"anchorUnits": "pixels",
"anchorString": "Sign Here",
"anchorIgnoreIfNotPresent": "true"
}],
"initialsTabs": [{
"yPosition": "45",
"xPosition": "249",
"width": "100",
"tablabel": null,
"required": "TRUE",
"receipientId": "1",
"pagenumber": "1",
"fontSize": "Size12",
"font": "Calibri",
"documentId": "1",
"anchorYoffset": null,
"anchorXOffset": null,
"anchorUnits": "pixels",
"anchorString": "Initials Here",
"anchorIgnoreIfNotPresent": "true"
}],
"dateSignedTabs": [{
"yPosition": "65",
"xPosition": "249",
"width": "100",
"tablabel": null,
"required": "TRUE",
"receipientid": "1",
"pagenumber": "1",
"fontSize": "Size12",
"font": "Calibri",
"documentid": "1",
"anchorYoffset": "-5",
"anchorXOffset": null,
"anchorUnits": "pixels",
"anchorString": "Date Signed",
"anchorIgnoreIfNotPresent": "true"
}]
},
"routingorder": "1",
"rolename": "roleNameHere",
"recipientid": "1",
"name": "XXXXXXXXXX",
"email": "xxxxx#gcpa.com"
}]
},
"emailsubject": "TestDocuSign Call",
"emailBlurb": "Test Email Blurb",
"documents": [{
"name": "Name1",
"fileExtension": ".pdf",
"documentId": "1",
"documentBase64": null
}]
}
--AAA
Content-Type: application/octet-stream
Content-Disposition: file; filename="Name1.pdf"; documentid="1"
Content-Transfer-Encoding: base64
VGhpcyBpcyBh

You can specify your base64 encoded document bytes in the documentBase64 property
POST https://demo.docusign.net/restapi/v2/accounts/xxxxx/envelopes HTTP/1.1
X-DocuSign-Authentication: {"Username":"xxxxxx","Password":"xxxxx","IntegratorKey":"xxxxxx"}
Content-Type: application/json
{
"status": "sent",
"recipients": {
"signers": [{
"tabs": {
<Removed tabs for brevity>
},
"routingorder": "1",
"rolename": "roleNameHere",
"recipientid": "1",
"name": "XXXXXXXXXX",
"email": "xxxxx#gcpa.com"
}]
},
"emailsubject": "TestDocuSign Call",
"emailBlurb": "Test Email Blurb",
"documents": [{
"name": "Name1",
"fileExtension": ".pdf",
"documentId": "1",
"documentBase64": "VGhpcyBpcyBh"
}]
}

Related

Appending the same values twice when iterating through two list

My ansible playbook:
- hosts: localhost
connection: local
gather_facts: no
become: no
vars:
- delete: [
{
"department_link": "https://servicenowservices.com/api/now/table/da/3fb1",
"hostname": "host1",
"value": "3fb1"
},
{
"department_link": "https://servicenowservices.com/api/now/table/da/3fb1",
"hostname": "host2",
"value": "3fb1133"
}
]
tasks:
- name: connect to service now cmdb table
uri:
url: "{{item.department_link}}"
method: GET
body_format: form-urlencoded
user: "user"
password: "password"
timeout: 200
validate_certs: no
loop: "{{delete}}"
register: test
no_log: yes
- debug:
var: test.results
- name: combine
set_fact:
final: "{{ final | default([]) + [ item[0] | combine({'department': item[1].json.result.name | default(None)}) ] }}"
when:
- item[1].json.result.sys_id | string == item[0].value | string
with_nested:
- "{{delete}}"
- "{{test.results}}"
no_log: yes
- debug:
var: final
debug of the var: test.results -- truncated. -- please go to the end of the page for full output.
"test.results": [
"json": {
"result": {
"name": "dept1",
"sys_id": "3fb1",
}
},
"json": {
"result": {
"name": "dept1",
"sys_id": "3fb1",
}
}]
debug of the var: final
ok: [localhost] => {
"final": [
{
"department": 'dept1",
"department_link": "https://servicenowservices.com/api/now/table/da/3fb1",
"hostname": "host1",
"value": "3fb1"
},
{
"department": "dept1",
"department_link": "https://servicenowservices.com/api/now/table/da/3fb1",
"hostname": "host1",
"value": "3fb1"
}
]
}
You can see from the above, when I iterate though two lists and combine two list into one when the condition is satisfied, it for some reason put the output twice. I have tried many different ways but no luck.
So the result I want is:
for the var: final - I want the ouput to only be one dict in the list like so
"final": [
{
"department": 'dept1",
"department_link": "https://servicenowservices.com/api/now/table/da/3fb1",
"hostname": "host1",
"value": "3fb1"
}]
Please let me know how I can achieve this.
Below is the full output of test.results and I printed its type as well. Hope this will help!!
TASK [debug]
ok: [localhost] => {
"test.results": [
{
"ansible_loop_var": "item",
"cache_control": "no-cache,no-store,must-revalidate,max-age=-1",
"changed": false,
"connection": "close",
"content_type": "application/json;charset=UTF-8",
"cookies": {
"cook": "random input"
},
"cookies_string": "cookies",
"date": "Thu, 06 Oct 2022 17:03:50 GMT",
"elapsed": 0,
"expires": "0",
"failed": false,
"invocation": {
"module_args": {
"attributes": null,
"backup": null,
"body": null,
"body_format": "raw",
"client_cert": null,
"client_key": null,
"content": null,
"creates": null,
"delimiter": null,
"dest": null,
"directory_mode": null,
"follow": false,
"follow_redirects": "safe",
"force": false,
"force_basic_auth": false,
"group": null,
"headers": {},
"http_agent": "ansible-httpget",
"method": "GET",
"mode": null,
"owner": null,
"password": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER",
"regexp": null,
"remote_src": null,
"removes": null,
"return_content": false,
"selevel": null,
"serole": null,
"setype": null,
"seuser": null,
"src": null,
"status_code": [
200
],
"timeout": 2000,
"unix_socket": null,
"unsafe_writes": false,
"url": "https://servicenowservices.com/api/now/table/da/3fb1",
"url_password": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER",
"url_username": "user",
"use_proxy": true,
"user": "user",
"validate_certs": false
}
},
"item": {
"department_link": "https://servicenowservices.com/api/now/table/da/3fb1",
"hostname": "host1",
"value": "3fb1"
},
"json": {
"result": {
"business_unit": "",
"code": "",
"cost_center": "",
"dept_head": "",
"description": "",
"head_count": "",
"id": "",
"name": "FZB2",
"parent": "",
"primary_contact": "",
"sys_created_by": "$test",
"sys_created_on": "2017-01-25 05:43:39",
"sys_id": "3fb1",
"sys_mod_count": "0",
"sys_tags": "",
"sys_updated_by": "$test",
"sys_updated_on": "2017-01-25 05:43:39"
}
},
"msg": "OK (unknown bytes)",
"pragma": "no-store,no-cache",
"redirected": false,
"server": "ServiceNow",
,
"status": 200,
"strict_transport_security": "max-age=63072000; includeSubDomains",
"transfer_encoding": "chunked",
"url": "https://servicenowservices.com/api/now/table/da/3fb1",
"x_is_logged_in": "true",
"x_transaction_id": "id"
},
{
"ansible_loop_var": "item",
"cache_control": "no-cache,no-store,must-revalidate,max-age=-1",
"changed": false,
"connection": "close",
"content_type": "application/json;charset=UTF-8",
"cookies": {
"cook": "random input",
},
"cookies_string": "cookies",
"date": "Thu, 06 Oct 2022 17:03:51 GMT",
"elapsed": 0,
"expires": "0",
"failed": false,
"invocation": {
"module_args": {
"attributes": null,
"backup": null,
"body": null,
"body_format": "raw",
"client_cert": null,
"client_key": null,
"content": null,
"creates": null,
"delimiter": null,
"dest": null,
"directory_mode": null,
"follow": false,
"follow_redirects": "safe",
"force": false,
"force_basic_auth": false,
"group": null,
"headers": {},
"http_agent": "ansible-httpget",
"method": "GET",
"mode": null,
"owner": null,
"password": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER",
"regexp": null,
"remote_src": null,
"removes": null,
"return_content": false,
"selevel": null,
"serole": null,
"setype": null,
"seuser": null,
"src": null,
"status_code": [
200
],
"timeout": 200,
"unix_socket": null,
"unsafe_writes": false,
"url": "https://servicenowservices.com/api/now/table/da/3fb1",
"url_password": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER",
"url_username": "user",
"use_proxy": true,
"user": "user",
"validate_certs": false
}
},
"item": {
"department_link": "https://servicenowservices.com/api/now/table/da/3fb1",
"hostname": "host2",
"value": "3fb1"
},
"json": {
"result": {
"business_unit": "",
"code": "",
"cost_center": "",
"dept_head": "",
"description": "",
"head_count": "",
"id": "",
"name": "FZB2",
"parent": "",
"primary_contact": "",
"sys_created_by": "$test",
"sys_created_on": "2017-01-25 05:43:39",
"sys_id": "id",
"sys_mod_count": "0",
"sys_tags": "",
"sys_updated_by": "$test",
"sys_updated_on": "2017-01-25 05:43:39"
}
},
"msg": "OK (unknown bytes)",
"pragma": "no-store,no-cache",
"redirected": false,
"server": "ServiceNow",
"set_cookie": "glide_user=; Max-Age=0; Expires=Thu, 01-Jan-1970 00:00:10 GMT; Path=/; HttpOnly; SameSite=None; Secure, glide_user_session=; Max-Age=0; Expires=Thu, 01-Jan-1970 00:00:10 GMT; Path=/; HttpOnly; SameSite=None; Secure, glide_user_route=glide.idd; Max-Age=2147483647; Expires=Tue, 24-Oct-2090 20:17:58 GMT; Path=/; HttpOnly; SameSite=None; Secure, glide_session_store=3348D7BA1B561150C71B8557EC4BCB27; Max-Age=300; Expires=Thu, 06-Oct-2022 17:08:51 GMT; Path=/; HttpOnly; SameSite=None; Secure",
"status": 200,
"strict_transport_security": "max-age=63072000; includeSubDomains",
"transfer_encoding": "chunked",
"url": "https://servicenowservices.com/api/now/table/da/3fb1",
"x_is_logged_in": "true",
"x_transaction_id": "123"
}
]
}
TASK [debug]
ok: [localhost] => {
"test.results | type_debug": "list"
}
You are facing this issue because test.results varialbe have duplicate json blocks.
I have removed them using map and unique functions
Please try this modified task
- name: combine
set_fact:
final: "{{ final | default([]) + [ item[0] | combine({'department': item[1].result.name | default(None)}) ] }}"
when:
- item[1].result.sys_id | string == item[0].value | string
with_nested:
- "{{delete}}"
- "{{test.results | map(attribute='json') | unique }}"
no_log: yes

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).

DocuSign Envelope in status 'Created' which stores it in draft folder and when I click Send the envelope is not received by the recipient.

DocuSign Envelope in status 'Created' which stores it in draft folder. When I click 'Send', envelope is not received by the recipient. It shows in 'Waiting for Others'. What does that mean? My Envelope request JSON is as below. After I get envelope Id I make a POST request to do embedded signing, I get the sender view url which opens in a new SalesForce Tab. When I click 'Send' it displays 'Success' message but the recipient does not get email.
{
"status": "created",
"recipients": {
"signers": [{
"tabs": {
"signHereTabs": [{
"yPosition": null,
"xPosition": null,
"width": "100",
"TabLabel": null,
"tabid": null,
"ScaleValue": null,
"required": "TRUE",
"RecipientId": "1",
"pageNumber": "1",
"optional": "false",
"Name": null,
"fontSize": "Size12",
"font": "Calibri",
"DocumentId": "1",
"anchorYoffset": null,
"anchorXOffset": null,
"anchorUnits": "pixels",
"anchorString": "Applicant Sign Here",
"anchorIgnoreIfNotPresent": "true"
}],
"initialHereTabs": [{
"yPosition": null,
"xPosition": null,
"width": "100",
"TabLabel": null,
"tabid": null,
"ScaleValue": null,
"required": "TRUE",
"RequireAll": "FALSE",
"RecipientId": "1",
"pageNumber": "1",
"optional": "false",
"Name": null,
"fontSize": "Size12",
"font": "Calibri",
"documentId": "1",
"anchorYoffset": null,
"anchorXOffset": null,
"anchorUnits": "pixels",
"anchorString": "Applicant Initial Here",
"anchorIgnoreIfNotPresent": "true"
}],
"dateSignedTabs": [{
"yPosition": null,
"xPosition": null,
"width": "100",
"TabLabel": null,
"tabid": null,
"ScaleValue": null,
"required": "TRUE",
"RecipientId": "1",
"pageNumber": "1",
"Name": null,
"fontSize": "Size12",
"font": "Calibri",
"DocumentId": "1",
"anchorYoffset": null,
"anchorXOffset": null,
"anchorUnits": "pixels",
"anchorString": "Applicant Date Signed",
"anchorIgnoreIfNotPresent": "true"
}]
},
"routingOrder": null,
"rolename": null,
"recipientId": "1",
"name": "XXXXXXXXX",
"email": "xyz#gcps.com",
"clientUserId": "1000"
}, {
"tabs": {
"signHereTabs": [{
"yPosition": null,
"xPosition": null,
"width": "100",
"TabLabel": null,
"tabid": null,
"ScaleValue": null,
"required": "TRUE",
"RecipientId": "1",
"pageNumber": "1",
"optional": "false",
"Name": null,
"fontSize": "Size12",
"font": "Calibri",
"DocumentId": "1",
"anchorYoffset": null,
"anchorXOffset": null,
"anchorUnits": "pixels",
"anchorString": "Guarantor SignHere",
"anchorIgnoreIfNotPresent": "true"
}],
"initialHereTabs": [{
"yPosition": null,
"xPosition": null,
"width": "100",
"TabLabel": null,
"tabid": null,
"ScaleValue": null,
"required": "TRUE",
"RequireAll": "FALSE",
"RecipientId": "1",
"pageNumber": "1",
"optional": "false",
"Name": null,
"fontSize": "Size12",
"font": "Calibri",
"documentId": "1",
"anchorYoffset": null,
"anchorXOffset": null,
"anchorUnits": "pixels",
"anchorString": "Guarantor Initial Here",
"anchorIgnoreIfNotPresent": "true"
}],
"dateSignedTabs": [{
"yPosition": null,
"xPosition": null,
"width": "100",
"TabLabel": null,
"tabid": null,
"ScaleValue": null,
"required": "TRUE",
"RecipientId": "1",
"pageNumber": "1",
"Name": null,
"fontSize": "Size12",
"font": "Calibri",
"DocumentId": "1",
"anchorYoffset": null,
"anchorXOffset": null,
"anchorUnits": "pixels",
"anchorString": "Guarantor Date Signed",
"anchorIgnoreIfNotPresent": "true"
}]
},
"routingOrder": null,
"rolename": null,
"recipientId": "2",
"name": "XXXXXXXXXTestcase",
"email": "yyy#gcps.com",
"clientUserId": "2000"
}],
"carbonCopies": [{
"routingOrder": "11",
"recipientId": "11",
"name": "DealerFunding",
"email": "ggggg#cccc.com"
}, {
"routingOrder": "12",
"recipientId": "12",
"name": "CURRENt_DSR",
"email": "tttt#hkhhk.com"
}, {
"routingOrder": "13",
"recipientId": "13",
"name": "DSR_TEAM_LEAD",
"email": "JohnDoe#gcpa.com"
}]
},
"messagelock": "false",
"emailsubject": "Test Subject",
"emailblurb": "Test Message",
"documents": [{
"name": "CodeOfConduct.pdf",
"documentid": "1",
"documentBase64": null
}]
}
You are specifying Signer.ClientUserId which indicates that signer is an embedded recipient. Email will be sent to the Signer if you create the envelope without the ClientUserId parameter.
For embedded signing, after envelope creation, your application will have to make a call to EnvelopeViews:CreateRecipient and generate the signing URL.

Join 2 arrays by key and value (AngularJS)

I have 2 objects
{
"_id": "58b7f36b3354c24630f6f3b0",
"name": "refcode",
"caption": "Reference",
"type": "string",
"search": false,
"required": false,
"table": true,
"expansion": true
},
and
{
"_id": "58b7f36b3354c24630f6f3c8",
"vacancyid": "0",
"refcode": "THIS IS MY REF",
"position": "Test",
"jobtype": "Temp",
"department": "Industrial",
"branch": "Office",
"startdate": "02/12/2013",
"contactname": "Person Name",
"contactemail": "person#domain",
"Q_V_TYP": "Daily",
"score": 0
},
Object one defines what a field should be and what it is called
The second object is a job description.
What i need is to match a field to each key (this even sounds confusing i my head, so here is an example)
{
"_id": "58b7f36b3354c24630f6f3c8",
"vacancyid": "0",
"refcode": {
"_id": "58b7f36b3354c24630f6f3b0",
"name": "refcode",
"caption": "Reference",
"type": "string",
"search": false,
"required": false,
"table": true,
"expansion": true,
"value": "THIS IS MY REF"
}
},
"position": "Test",
"jobtype": "Temp",
"department": "Industrial",
"branch": "Office",
"startdate": "02/12/2013",
"contactname": "Person Name",
"contactemail": "person#domain",
"Q_V_TYP": "Daily",
"score": 0
},
Here you go:
var def = {
"_id": "58b7f36b3354c24630f6f3b0",
"name": "refcode",
"caption": "Reference",
"type": "string",
"search": false,
"required": false,
"table": true,
"expansion": true
};
var jobDesc = {
"_id": "58b7f36b3354c24630f6f3c8",
"vacancyid": "0",
"refcode": "THIS IS MY REF",
"position": "Test",
"jobtype": "Temp",
"department": "Industrial",
"branch": "Office",
"startdate": "02/12/2013",
"contactname": "Person Name",
"contactemail": "person#domain",
"Q_V_TYP": "Daily",
"score": 0
};
var jobDescKeysArr = Object.keys(jobDesc);
if (jobDescKeysArr.indexOf(def.name) !== -1) {
// A match.
def.value = jobDesc[def.name];
jobDesc[def.name] = Object.assign({}, def);
console.log(jobDesc)
}

extjs nested json

Getting conflicting information from various places on whether or not nested json is available in extjs. NB using Sencha Architect which may be complicating things...
I have a client json object being returnd via a store/ajax proxy. I can not access anything beyond the first level.
JSON looks like this:
{
"client": {
"0": {
"id": "12345",
"type_id": "3",
"association_id": "0",
"is_active": "1",
"manager_id": "2",
"business_name": null,
"has_payroll": "0",
"business_proprietor_contact_id": null,
"date_created": "1358893243",
"date_modified": "1358893243"
},
"contacts": [
{
"id": "1",
"client_id": "12345",
"contact_id": "1",
"is_primary": "0",
"display_priority": "0",
"relationship": "Client",
"friendly_name": "Homer",
"contact": [
{
"id": "1",
"surname": "Mr.",
"first_name": "Homer",
"middle_name": "J",
"last_name": "Simpson",
"client_id": "12345",
"date_created": "1356038714",
"date_modified": null
},
{
"addresses": [
{
"id": "1",
"contact_id": "1",
"address_id": "16",
"is_mailing_address": "0",
"is_primary_address": "0",
"display_priority": "0",
"address": {
"0": {
"id": "16",
"address": "5 Dirt Rd",
"address2": "",
"city": "TAXMASTER",
"state": "NY",
"zip_code": "454545",
"country": "USA",
"other": null,
"phone": null,
"fax": null,
"display_priority": null,
"is_mailing_address": "1"
},
"data": [
{
"id": "10",
"label": "Phone",
"value": "BUT WHO WAS",
"date_created": "1356104685",
"date_modified": "1357142782",
"user_id": null,
"display_priority": null,
"client_id": null,
"contact_id": null,
"account_id": null,
"business_id": null,
"address_id": "16",
"is_deleted": "0"
},
{
"id": "14",
"label": "Fax",
"value": "simile",
"date_created": "1356557379",
"date_modified": "1357142782",
"user_id": null,
"display_priority": null,
"client_id": null,
"contact_id": null,
"account_id": null,
"business_id": null,
"address_id": "16",
"is_deleted": "0"
},
{
"id": "17",
"label": "Also Known as:",
"value": "DUDE",
"date_created": "1357141357",
"date_modified": "1357142782",
"user_id": null,
"display_priority": null,
"client_id": null,
"contact_id": null,
"account_id": null,
"business_id": null,
"address_id": "16",
"is_deleted": "0"
}
]
}
},
{
"id": "6",
"contact_id": "1",
"address_id": "26",
"is_mailing_address": "0",
"is_primary_address": "0",
"display_priority": "0",
"address": {
"0": {
"id": "26",
"address": "1 Lift Road",
"address2": "",
"city": "Tony Beach",
"state": "KS",
"zip_code": "15151",
"country": "USA",
"other": null,
"phone": null,
"fax": null,
"display_priority": null,
"is_mailing_address": "0"
},
"data": [
{
"id": "18",
"label": "Phone:",
"value": "cool phone number",
"date_created": "1357141527",
"date_modified": "1357141527",
"user_id": null,
"display_priority": null,
"client_id": null,
"contact_id": null,
"account_id": null,
"business_id": null,
"address_id": "26",
"is_deleted": "0"
},
{
"id": "19",
"label": "Note:",
"value": "cool note",
"date_created": "1357141527",
"date_modified": "1357141527",
"user_id": null,
"display_priority": null,
"client_id": null,
"contact_id": null,
"account_id": null,
"business_id": null,
"address_id": "26",
"is_deleted": "0"
}
]
}
},
],
"data": [
{
"id": "1",
"label": "asdf",
"value": "dfdfefefefef",
"date_created": "1356038714",
"date_modified": "1356040822",
"user_id": "2",
"display_priority": "0",
"client_id": null,
"contact_id": "1",
"account_id": null,
"business_id": null,
"address_id": null,
"is_deleted": "0"
},
{
"id": "2",
"label": "asfd",
"value": "152151",
"date_created": "1356038714",
"date_modified": "1356040822",
"user_id": null,
"display_priority": "2",
"client_id": null,
"contact_id": "1",
"account_id": null,
"business_id": null,
"address_id": null,
"is_deleted": "0"
},
]
}
]
},
{
"id": "7",
"client_id": "12345",
"contact_id": "11",
"is_primary": "0",
"display_priority": "0",
"relationship": "None",
"friendly_name": "Mary Jane",
"contact": {
"0": {
"id": "11",
"surname": "",
"first_name": "Mary Jane",
"middle_name": "",
"last_name": "Simpson",
"client_id": null,
"date_created": "1357145795",
"date_modified": null
},
"7": {
"addresses": [
{
"id": "11",
"contact_id": "11",
"address_id": "33",
"is_mailing_address": "0",
"is_primary_address": "0",
"display_priority": "0",
"address": {
"0": {
"id": "33",
"address": "33 Street",
"address2": "",
"city": "NY",
"state": "NY",
"zip_code": "06830",
"country": "USA",
"other": null,
"phone": null,
"fax": null,
"display_priority": null,
"is_mailing_address": "0"
},
"data": [
{
"id": "31",
"label": "Fax:",
"value": "asdfasdf",
"date_created": "1357145905",
"date_modified": "1357145939",
"user_id": null,
"display_priority": null,
"client_id": null,
"contact_id": null,
"account_id": null,
"business_id": null,
"address_id": "33",
"is_deleted": "0"
},
{
"id": "32",
"label": "Fax:",
"value": "sadfsadf",
"date_created": "1357145905",
"date_modified": "1357145905",
"user_id": null,
"display_priority": null,
"client_id": null,
"contact_id": null,
"account_id": null,
"business_id": null,
"address_id": "33",
"is_deleted": "0"
}
]
}
}
],
"data": [
{
"id": "29",
"label": "Phone:",
"value": "asdfsadf",
"date_created": "1357145833",
"date_modified": "1357145833",
"user_id": "2",
"display_priority": null,
"client_id": null,
"contact_id": "11",
"account_id": null,
"business_id": null,
"address_id": null,
"is_deleted": "0"
},
{
"id": "30",
"label": "Email:",
"value": "dsfgdsfg",
"date_created": "1357145855",
"date_modified": "1357145855",
"user_id": "2",
"display_priority": null,
"client_id": null,
"contact_id": "11",
"account_id": null,
"business_id": null,
"address_id": null,
"is_deleted": "0"
}
]
}
}
}
],
"notes": [
{
"id": "5",
"client_id": "12345",
"label": "This is a HomerHomer Note",
"value": "This is from Homer's Dashboard Notes.",
"contact_id": null,
"address_id": null,
"account_id": null,
"account_data_id": null,
"account_credential_id": null,
"payment_id": null,
"contact_log_id": null,
"user_id": "2",
"bill_id": null,
"is_deleted": "0",
"date_created": "1357148256",
"date_modified": "1357148256"
}
]
}
}
According to https://stackoverflow.com/a/8318589/183254 nested JSON isn't available. According to https://stackoverflow.com/a/5604594/183254 it is available, but has to be in a certain format.
I did a little test based on the API docs format:
{
results: 2000,
rows: [
{ id: 1, firstname: 'Bill', occupation: 'Gardener', cool: {neat: 'wow'} },
{ id: 2, firstname: 'Ben' , occupation: 'Horticulturalist' },
]
}
with this coming in, I can call everything from a tpl. In particular, cool.neat prints wow. However, changing cool to cool:[{neat:'wow}] breaks. So it seems nested json partially works -- likely only partially because I'm doing something wrong.
My thinking was that it'd make sense to do a single request to the api and gather all the needed info, parse it, and send it out to components rather than creating proxies for every group of data that is needed. I may be wrong...
Along with needed guidance/facepunches I have 2 questions:
1) Is it possible/practical to try and do what I'm doing? i.e. trying to use a single request to gather the data for multiple components?
2) Is there a way to debug data from tpl?
This is extjs 4.1 via Sencha Architect
Thanks.
I had this same issue. The only way I could get around it (I tried mapping and several other solutions) is basically have a main store and substores. Get the information from ajax and bring it into the main store. Have a "load" listener and when it loads, check to see if the inforamtion needs to be passed to the other store(s).
Set all the substores autoload property to false and never load them.
i.e:
load: function(t,records,successful,eOpts) {
var substores [{store: nameOfStore, root: rootPropInTheJson},
{store...etc...etc..];
for (var i = 0; i < substores.length; i++) {
if (pathtoroot* != undefined) {
substores[i].store.add(pathtojsonroot)
}
}
}
At least, this is what I think you meant. If this is what you meant, then yes, I found it practical, and I don't know the answer to the second question.

Resources