cancel
Showing results for 
Search instead for 
Did you mean: 

WorkView View Error due to OnLoad script

Amber_Hudson1
Confirmed Champ
Confirmed Champ

I have a workview class with multiple views. Each view has its own usergroup so that the user sees the view appropriate for them. I do however have a fair number of people who belong to multiple groups so they have access to multiple views. I am attempting to open the correct view based on an attributes value and the users User Group. The functionality I have works however on the initial load of the object I get this error:

System.Exception: cannot call methods on FolderingControl prior to initialization; attempted to call method 'setContentHeight' ---> System.Exception: cannot call methods on FolderingControl prior to initialization; attempted to call method 'setContentHeight' occurred
--- End of inner exception stack trace ---

This is the code where the problem is originating:

if(status == "Pending ELT Approval")
{
if(Screen.CurrentUser.UserGroups.indexOf("OIT_OnBase_OITPAR_ELTApprovers") >= 0)
{
Screen.Views("ELT Approver").Load();
Screen.DisplayStatusMessage("ELT in OIT_OnBase_OITPAR_ELTApprovers Group "+status)
Screen.Views("ELT Approver").Focus();

}
}

Since OnBase Javascript isn't exactly a full blown version I am unsure how to fix this problem. I tried adding in the middle line to give it a bit of a delay between the Load and Focus but that didn't work. We are on vs. 18.0.1.49. Any help is greatly appreciated.

 

Amber

1 ACCEPTED ANSWER

Amber_Hudson1
Confirmed Champ
Confirmed Champ

I got it working everywhere but in my workflow queue, the error still shows up there. If your interested I had to set the .Load() on the initial screen and the .Focus() on the actual view so that the view loads before it focuses. Still get the same error in the workflow queue though, not sure how to fix that one.

 

View answer in original post

2 REPLIES 2

Michael_Zander1
Champ in-the-making
Champ in-the-making

I assume you put the script on the OnLoadEvent of the first view/tab. I think, that the other views are not yet available in the moment the event is fired, because they will be setup after the loading of the first tab.

Probably your code works well if you put a button with the same functionality on the first tab. I understand that this will not hit your requirement, but would be a test if the code is ok.

Michael 

Amber_Hudson1
Confirmed Champ
Confirmed Champ

I got it working everywhere but in my workflow queue, the error still shows up there. If your interested I had to set the .Load() on the initial screen and the .Focus() on the actual view so that the view loads before it focuses. Still get the same error in the workflow queue though, not sure how to fix that one.