Hexagon Geospatial
MENU

Developer Discussions

Discuss topics with other Hexagon Geospatial Power Portfolio developers and experts to get the most out of our products.
Showing results for 
Search instead for 
Do you mean 
Reply
Highlighted
Contributor
Posts: 45
Registered: ‎11-12-2015
Accepted Solution

GMSC - using scripting object in form:ready event

[ Edited ]

Hi all,

 

I have my own scripting object in java and I also use function from SCDefaultScriptingObject in 'form:ready' event called for workflow: 

 

IG.vent.on('form:ready', function () {

    IG.setZoomBox(-765757,-1149436,-765562,-1149684);
    MyScriptingObject.setSomething('TEST');

})

When I start workflow first time or if I click on "Reload Page" in workflow, I get:

 

"TypeError: undefined is not an object (evaluating 'SCDefaultScriptingObject().setZoomBox') (map.js,137)"

"TypeError: undefined is not a function (evaluating 'MyScriptingObject.setSomething()')') (init.js?v=636086837487998320,4)"

 

But when I start workflow second time, everything works fine (or if I start functions with button). I tried to add something like

MyScriptingObject = window.MyScriptingObject|| {};

to the beginning of the script, but it does not work either. I am using java 101.

 

How can I force GMSC to load scripting objects before my init function is executed? Any idea where the problem might be?

 

Thanks,

 

Tereza

 

Technical Evangelist
Posts: 114
Registered: ‎10-20-2015

Re: GMSC - using scripting object in form:ready event

Hi Tereza,

short background information.

 

-> User starts the workflow

-> GMSC uses the FX webbrowser to load the requested workflow

-> the page was successfully loaded and the workflow fires form:ready

-> GMSC injects it's scripting objects

-> GMSC fires the smartclient:ready event

 

Therefore form:ready is the wrong event. Use 'smartclient:ready'

 

Best Regards,

Steve

Contributor
Posts: 45
Registered: ‎11-12-2015

Re: GMSC - using scripting object in form:ready event

Hi Steve,

 

thank you for the explanation. It works.

 

Tereza

Do you need immediate support?
Please submit a Ticket through our
Development Ticket Portal.