cancel
Showing results for 
Search instead for 
Did you mean: 

Getting Session ID from Workview screen

Brian_Kalbfus
Confirmed Champ
Confirmed Champ

The Onbase 16 SDK mentions that there is a function to get the current Onbase Session ID via javascript in an eform:

window.external.GetSessionID();

This does not work when I test this in WorkView. I do see a valid sessionid in document.cookie.

Is there an API function to access the session id like there is documented for eforms, or is document.cookie the best place to get it?

Thanks!
Brian

1 ACCEPTED ANSWER

Brian_Kalbfus
Confirmed Champ
Confirmed Champ

HI Bobby,

In WorkView, external classes are great for viewing external databases in real-time.  Since they are read-only, the save button is disabled and calling Screen.SaveObject() is failing silently in my tests.  I would like to catch the user modifications and use script to handle the persistence or any other action that would be relevant to the application.

I have found no workview api hook for external classes that can be used to catch user modifications.  I can do a client-side action button to call a servlet.  JQuery has a post() method for this purpose.  Sending the Session ID to the servlet allows the servlet to connect to the AppServer with the sessionID to authorize the action on the external database.  This is the same purpose declared in the SDK for the SessionID being available for eForms.

Thank you!

Brian

View answer in original post

3 REPLIES 3

Bobby_Thompson
Employee
Employee

Hi Brian,

 

Unfortunately we do not expose the session ID from within a WorkView screen at this time. 

 

With this said, would you be able to provide details on what you need the session ID for? What is the use case that you are trying to solve?

 

Thanks,

Brian_Kalbfus
Confirmed Champ
Confirmed Champ

HI Bobby,

In WorkView, external classes are great for viewing external databases in real-time.  Since they are read-only, the save button is disabled and calling Screen.SaveObject() is failing silently in my tests.  I would like to catch the user modifications and use script to handle the persistence or any other action that would be relevant to the application.

I have found no workview api hook for external classes that can be used to catch user modifications.  I can do a client-side action button to call a servlet.  JQuery has a post() method for this purpose.  Sending the Session ID to the servlet allows the servlet to connect to the AppServer with the sessionID to authorize the action on the external database.  This is the same purpose declared in the SDK for the SessionID being available for eForms.

Thank you!

Brian

Thanks for the details Brian.

In this type of use case, where you want to surface external information and then allow a user to make modifications to it (persisting it back to a 3rd party system), we recommend the following approach:

1) Create a standard class that contains all of the attributes that the user should be able to modify (this could be a copy of all attributes on the external class)
2) Create a System Task (that will be executed via an action button). Configure this System Task to create a new object (Class = the new class you just created in step #1). Copy all values of the current external object to this new object. Display this new object to the user.
a. In most scenarios that this has been used, the action button is named something like: "Edit"
3) Configure a Workflow or Unity API event for OnBeforeSave or OnAfterSave (either will work) and in your logic, persist the values back to your 3rd party system.

I know of one nuance with this solution and that is you cannot 'close' the original external object unless you use a WorkView Action button calling a Unity Script (and using args.AddUICloseObject(...)). If you are certified for the API, I recommend this approach as it is a cleaner solution for the end user. If you can't use this approach, the user will end up with 2 objects open (the external object and the new object that can be modified).

I will get an SCR written up for the session access in the API.

Thanks,