Skip to main content

Hello,

 

I’m trying to model an process flow API which adds emails to a queue. I’ve got this all working, but i want to inform the sender that the email was correctly added, by returning the emails’ ID and status. I would like to use the response headers for this, but i’m experiencing some problems as into how i would format this correctly in SQL. 

 

According to the documentation (https://docs.thinkwisesoftware.com/docs/sf/process_flows#enable-the-message-protocol-independent-web-service) the response headers should be formatted like this: { "Header1": "value1", "value2" ]"Header2": e "value"] }   

 

My question is how i should archieve a format like that in SQL? I thought i could just format my variables like a json body by selecting them in a subquery with ‘for json path’, but that results in errors. I think this  feature was developed by you with supportive sql functions in mind to achieve this more easily. What is the correct way to achieve the format which Indicium accepts?

Hi @BramG ,

You can do this by using a query like this, for the values you can you a concat of string_agg if you are coming from a table.

select (select json_query('("value1","Value2"]')) as header1
,(select json_query('("value3"]')) as header2
for json path, without_array_wrapper

With this result:

{"header1":""value1","Value2"],"header2":""value3"]}

 

Hope this helps.


When i return the scope_identity(), indicium wants me to cast the integer value as a string, which i now did. After that, i get the following error: “Could not cast or convert from System.String to System.Stringn]”. Do i really have to concat these square brackets around the values or is there a cleaner solution?


After having a call with Bram we discovered a small error in the query, 1 square bracket was missing, I have edited my response which is correct now.