<% let data = { "getPrescriptionsByPatient": [ { "id": "10124680", "idType": "SPL_HB_PRESCRIPTION_ID_TYPE", "isReadyFill": true, "isRefillEligible": true, "mdoFlag": false, "drugInfo": { "drug": { "ndcId": "00003052811", "name": "SPRYCEL 50MG TABS" }, "ancillaryProductIndicator": "false" }, "patient": { "id": "7324859", "idType": "SPL_HB_PATIENT_ID_TYPE" }, "fills": [ { "fillNumber": 0, "isInitialFill": false } ] } ] } %> { "contents": { "intent": { "content": { "elements": [ { "elements": [ <% for (let i of data.getPrescriptionsByPatient) { %> { "action": "app://app.com/dialog/selectedintent?value=<%= i.drugInfo.drug.name %>&metadata=<%= i.id %>", "fillNumber": "<%= i.fills.fillNumber %>", "rxNumber": "<%= i.id %>", "ancillaryProductIndicator": "<%= i.drugInfo.ancillaryProductIndicator %>", "firstFillIndicator": "<%= i.fills.isInitialFill %>", "style": "left", "ndcid": "<%= i.drugInfo.drug.ndcId %>", "textValue": "<%= i.drugInfo.drug.name %>" }<% if (data.getPrescriptionsByPatient.indexOf(i) !== data.getPrescriptionsByPatient.length - 1) { %>,<% } %> <% } %> ], "minSelection": 1, "minSelectionErrorMessages": "Minimum one prescription should be selected", "objectType": "checkboxgroup", "style": "vertical", "submitButton": { "action": "app://app.com/chat/submitintent?value=I%20want%20to%20refill%20%24selection%24%20prescriptions", "style": "filled", "textValue": "Refill the selected Prescriptions" } }, { "action": "app://app.com/chat/submitintent?value=I%20want%20to%20refill%20all%20my%20prescriptions", "objectType": "button", "style": "filled", "textValue": "Refill all the prescriptions" }, { "action": "app://app.com/chat/submitintent?value=None%20of%20the%20above", "objectType": "button", "style": "text", "textValue": "I don't see the prescription in the above listed" } ], "objectType": "group", "style": "vertical" } }, "message": { "content": { "objectType": "text", "style": "body", "value": "You have <%= data.getPrescriptionsByPatient.length %> prescriptions eligible for refill. Please select from the list below." } } }, "statusCode": "0000", "statusDescription": "Success" }