Thursday, May 1, 2014

Relation between GotoView and ForceActive

Recently I have been debugging an issue, where while navigating back to the view where I presently was via a button on another view. I was not able able to see the correct values against the record there. And i have to re-query to get the values what is actually on that record.

On further deep-diving into the code, we have found out that we have used GotoView on the click of a button to go back to the view where the correct values, as I mentioned, were coming only after a re-query.

Now just to keep things simple for readers, just wanted to add that we have 2 options to go back from a certain place to a particular view, which are:

1) Application.GotoView(ViewName[, BusinessObjectName])

2) var oBS = TheApplication().GetService("FINS Teller UI Navigation");
    var psIn = TheApplication().NewPropertySet();
    var psOut = TheApplication().NewPropertySet();
    psIn.SetProperty("ViewName",<ViewName>);
    psIn.SetProperty("BusObj",<ViewBOName>); //Optional
    oBS.InvokeMethod("GotoView",psIn,psOut);
   
While you can use any of the above ways to navigate to a view, but please make sure that you have done the below:
1) Do a refresh/requery via script on load for the view's main applet you are navigating to. Preferably with some condition based on profile attribute so as to be performant.
2) Most importantly make sure that the fields which are exposed to the UI are force active, yes force active even though they are exposed to UI.

Now I want to stress on point 2, as this might seem unnecessary for some of you out there, you might be thinking why this needs to be force active if its already exposed to UI. Truly, we have read that one of the ways for which force active is not required for a field is that it is exposed to UI. 
But strangely enough, this is not the case when you are navigating back to a certain view with GotoView method. If the field is not force active, you will see its value until you do explicitly a re-query. This is Siebel for you. If you know the reason for this or want to state your reasoning for this, feel free to comment on this post.

One last thing, we have read that its not a good practice to make Force Active true for fields until or unless its unavoidable. So as a better alternative to resolve this blank value issue is to Activate the required fields before execute the query in script.

To sum it up when you use GotoView make sure you do:
1) Requery on load for the view's main applet.
2) Activate the fields which are not ForceActive and which exposed to UI.

Hope this help, feel free to raise queries via comment. Happy Exploring !!!