case 4004

This commit is contained in:
2021-10-15 00:19:49 +00:00
parent 1e69cd8e72
commit 270d242c7d

View File

@@ -0,0 +1 @@
{"Name":"Test API method to get customer data","Active":true,"Notes":"","Roles":124927,"AType":31,"IncludeWoItemDescendants":false,"Template":"<html>\n\n<body>\n {{#each ayReportData}}\n\n <h2>{{ CustomerViz }}</h2>\n Email: {{myCustomerInfo.emailAddress}}\n\n <!-- This is to see the raw data -->\n <pre>\n {{ayJSON this}}\n </pre>\n\n <hr/>\n\n {{/each}}\n</body>\n\n</html>","Style":"","JsPrerender":"async function ayPrepareData(ayData) {\n\n //Loop through all the records in the raw report data\n for (let i = 0; i < ayData.ayReportData.length; i++) {\n //set a temporary variable to each record to save typing it all out\n let item = ayData.ayReportData[i];\n\n //call into the AyaNova API and get the customer record for this report data's customer id\n const apiResult = await ayGetFromAPI(`customer/${item.CustomerId}`);\n\n //if a result comes back, insert it into the report data so it's available to the template\n if (apiResult) {\n //put the return data customer record on a key in each record called 'myCustomerInfo' (you can call it anything as long as it doesn't conflict with an existing key)\n item.myCustomerInfo = apiResult.data\n }\n }\n return ayData;\n}","JsHelpers":"","RenderType":0,"HeaderTemplate":null,"FooterTemplate":null,"DisplayHeaderFooter":false,"PaperFormat":10,"Landscape":false,"MarginOptionsBottom":null,"MarginOptionsLeft":null,"MarginOptionsRight":null,"MarginOptionsTop":null,"PageRanges":null,"PreferCSSPageSize":false,"PrintBackground":false,"Scale":1.00000}