For this I prefer the use of tasks/stored procedures with output parameters, which works fine.
To minimize the amount of requests I like to return detail data in JSON format as output. It works almost as expected, except that Indicium ads escape characters (backslashes).
I there any way or trick to get this solved?
Best answer by Vincent DoppenbergView original
I don't think your problem is that Indicium adds escape characters, I think your problem is that the value of "child_rows" is a singular string literal, rather than a nested JSON array.
What are you looking for is probably a response like the one below. Note that I didn't just remove the escape characters, I also removed the outer quotes.
At the moment there is no way to achieve this, but we are working on a way to request a table or view and expand detail references in a single request. This feature should become available in a matter of weeks.
This would be a nice extension of the API.
But actually I would prefer a solution that allows me to do one request and get a JSON output with multiple details and even with deeper nested detail levels.
This solution will actually allow you to get JSON output for multiple details in a single request. I'm not sure, however, if deeper nested details will be available as well. At the very least I do not expect deeper nested details to work in our initial implementation.
How many levels will you need to expand and how often do you expect to need this?
One level deeper would help already.
Max 5 levels deep, would be perfect.
I’m running into the samen problem and I’m wondering what solution you used. I try to return the results of an action performed in a task or stored procedure in JSON format and need to get rid of the escape characters.
We have since added a way to create fully customizable APIs to the Thinkwise Platform, which allow you to accept any kind of request and return any kind of response, including nested JSON structures.
This can be achieved by creating a process flow with the following checkbox turned on.
This allows you to assign request and response properties to process variables, which can be used to process a request yourself and set the response that you want to give.
Anne Buit has written an extensive, two-part blog on this feature:
In particular, the following example from the blog should be interesting to you. The code behind these examples is included in the blog.
I hope this helps.
@Vincent Doppenberg, thanks for your quick response. It looks like this is exactly what I was looking for.
does this mean that when having a task or subroutine with a json formatted output parameter, this always will be converted into a string with escape characters?
And the only way to get it properly formatted as json for an API is to use a process flow as API as explained in the blog?
@HJ van Dalfsen,
Yes, that is correct.
Indicium outputs its own JSON for tasks and subroutines and the output parameters of these tasks and subroutines, including their values, are simply properties inside of this larger JSON structure. Furthermore, there is currently no JSON data type that can be configured on a domain in the SF, so the values given to these output parameters cannot be JSON, strictly speaking. They are simply (n)varchar values and so they are returned with surrounding quotations marks and the necessary characters are escaped.
With that said, there is no reason to think that the offered solution with process flows is inferior. It's quite simple to configure in the SF, you can make the API identical to that of a subroutine and you have full control over the returned response.