I have a stored procedure that I’m pulling data sets into Azure Logic Apps Designer. no matter what I try – nothing wants to plug into the send email function. some things that seem like a no brainer => DataOperations => Compose (making a full html table), or Create HTML Table, or Create CSV Table – All create a Foreach loop around the object, then will not in bed into the email – which is HTML code capable.
I can just in bed the body – which is a monstrosity of data, but that’s not going to work.
How can I format the SQL data into tables, and send them in a single email. Being able to add a custom entry for a Click me would also be a must.
most of the above was not saving due to error, or would not run. the Data Operations of objects is what I had been working with so far, but I need a working table in an email from the SQL data.
here are the results of the 2 sets of objects that it can spit out, body just being a higher version of result sets it seems. also note this is a single result:
BODY:
{"ResultSets":{"Table1":[{"Title":"Test #3556 - legal","ID":176,"ExecutionDate":"2023-04-27T00:00:00","Division":"Banking","Program":"Banking","ContractType":"Invitation for Bid ("IFB")","Name":"BedRock Concrete"}]},"ReturnCode":0,"OutputParameters":{}}
resultsets:
{"Table1":[{"Title":"Test #3556 - legal","ID":176,"ExecutionDate":"2023-04-27T00:00:00","Division":"Banking","Program":"Banking","ContractType":"Invitation for Bid ("IFB")","Name":"BedRock Concrete"}]}
so i missed a type of return object –
BODY & Resultsets: gave too much information since it looked like there was a possibility of additional tables to come back. i only called for a single table, so at the bottom of my list I found "Table1" – after using it – it was giving me the results I wanted – a single table representation. This will also allow me to break up the data and give specific header under the CREATE HTML TABLE option.
my end logic app will be Recurance => Execute Stored Procedure => Create HTML Table Feeding in "Table1" objects data => Send Email feeding in CreateHTMLTable.
2
Answers
so i missed a type of return object -
BODY & Resultsets: gave too much information since it looked like there was a possibility of additional tables to come back. i only called for a single table, so at the bottom of my list I found "Table1" - after using it - it was giving me the results I wanted - a single table representation. This will also allow me to break up the data and give specific header under the CREATE HTML TABLE option.
my end logic app will be Recurance => Execute Stored Procedure => Create HTML Table Feeding in "Table1" objects data => Send Email feeding in CreateHTMLTable.
I have reproduced in my environment got expected results:
I have used For Each and faced similar issues, so i alternatively used another method:
Output:
Logic app code: