Terry Gilliver
Posts: 0
Joined: Fri Apr 18, 2014 8:45 pm

Creating a service that contains arrays of objects in the body

I want to configure a service which has a body similar to the following:

code{
"to" : [
{"to": "terry@mrtaxsoftware.com",
"toName" : "Terry Gilliver"}
],
"from" : "web@comp-solutions.org.uk",
"fromName" : "WEB Test",
"bcc" : [
{"bcc" : "terry@comp-solutions.org.uk",
"bccName" : "Terry Gilliver"},
{"bcc" : "terry@mrtaxsoftware.com",
"bccName" : "Terry Gilliver"}
],
"subject" : "test subject",
"body" : "test body"
}/code

I tried to create this as follows:

Image

I must have it wrong as the objects within the array are greyed out so I can't test

Terry Gilliver
Posts: 0
Joined: Fri Apr 18, 2014 8:45 pm

Creating a service that contains arrays of objects in the body

Even though it is not possible to test, it does actually work in practice.

I called it with the following javascript and it worked

pre
sendMail.execute({
headers: {
"Authorization" : "Basic *******************"
},
data: {
"from" : "web@comp-solutions.org.uk",
"fromName" : "MyTaxBuddy",
to: [{
"to" : Apperyio.storage.email.get(),
"toName" : Apperyio.storage.email.get()
}],
bcc: [{
"bcc" : "terry@mrtaxsoftware.com",
"bccName" : "Terry GIlliver"
}],
"subject" : "Tax Refund Calculator Report",
"body" : "Please find attached Tax Refund Calculator Report",
attachment: [{
"path" : Apperyio.storage.pdfuri.get(),
"name" : "Tax Refund Calulator Report.pdf"
}]
},
success: function (data, textStatus, jqXHR) {
Alert("Email Success");
},
error: function (jqXHR,textStatus,errorThrown) {
postError(jqXHR, textStatus, errorThrown);
}
})
/pre

Return to “Issues”