JSDO and Business Entities: Common solution for information/

Posted by Patrik Wikström on 24-Apr-2018 01:08

Hi!

Is there any plans for a common and elegant solution for information/warning messages to be passed when the business entity (BE) transaction succeeds but we still want to inform the user about something? Would perhaps not want to add something to the ProDataSet of the BE? Same question would apply for invokable methods if we don't use the parameter class for that information, case by case?

We are using the SmartComponentLibrary from Consultingwerk.

Br,

Patrik Wikström

All Replies

Posted by egarcia on 02-May-2018 16:27

Hello Patrik,

Are you using WebHandler or REST as the transport?

I have not heard a particular plan to provide this, however, I wonder if the Session Context functionality would address your requirement.

With the Session Context functionality, you can pass JSON data from the client to the server and vice versa.

For this functionality, you would set a the X-CLIENT-CONTEXT HTTP header on the server, then retrieve the context on the client-side using getContext() on the JSDOSession.

A possible approach is to set a particular ID as part of your request so that the reply from the server is specific to the given request.

The following thread has some details on the usage of X-CLIENT-CONTEXT and has a sample program showing how to set it:

- community.progress.com/.../110005

Please notice that user roles support in KUIB 2.1 uses a different approach than the one mentioned in the the thread:

- community.progress.com/.../2939.how-to-implement-user-roles-in-kendo-ui-builder-2-1-with-an-openedge-backend

Please let me know what you think of this approach and if you need additional information.

If the Session Context functionality does not address your requirement, please, feel free to add a suggestion to the Ideas section.

I hope this helps.

Thank you and regards,

Edsel

Posted by Mike Fechner on 03-May-2018 00:24

Hi Edsel,

he's using Web Handler. We can look into that. But using context for an additional request response seems wrong.

If we'd add additional JSON data to the response of an update call - besides the dataset, so that the JSON returned from the JSDO would be:

{ "dsCustomer": { "eCustomer" : [  .... ] },

 "messages": [ "Update successful, 10 records processed" ] }

Would the JSDO be o.k. with receiving such a response?

And how could we get access to this additional data on the frontend?

Posted by Patrik Wikström on 03-May-2018 05:27

I'm also thinking about a successful invokable method call that could return the dataset/input object but also optionally some message (that could be shown to the user).

Posted by Mike Fechner on 03-May-2018 05:52

Invokable methods ain’t a problem – as you can have additional parameters there.

Posted by Patrik Wikström on 03-May-2018 06:20

I know that, but I thought it could be nice to have one common solution?

Posted by egarcia on 03-May-2018 09:03

Hello Mike,

> Would the JSDO be o.k. with receiving such a response?

> And how could we get access to this additional data on the frontend?

Adding additional properties to the payload could also work. You would not need to try it out.

This would be somewhat similar to when "prods" properties are returned for the dataset. In this case they would be at the top level.

The processing looks for the DS to process the response and write to the JSDO memory.

To access the additional data, you could would need to look at the response parameter in the success handler for the promise.

I hope this helps,

Edsel

This thread is closed