Queue Method from scope other than globals

Hi All

I have a scope call services within my solution.
I am creating a headless client based on same solution and when i try to queue a function from my scopes.services i get the following

callback data, name: global methodname: doTest didnt resolve to a method in solution scm_riscm

Is there a special notation to use to queue a function from a new scope?

Anyone from Servoy have some info?

For smart and web clients, the context is the entire solution…all modules. Headless client the context is only the module (and modules included in it) that you specify in the session:

HeadlessClientFactory.createSessionBean(request,"myServoyModule")

I suspect the scope your are calling is in a module outside the context of your headless client.

Hi David

All the code is contained within the same solution, no module calls are made.
My code is declared in a scope of the same solution started as a headless client hence i am stumped.

Can you show the line of code, where you call the headlessclient and which syntax you use the set the callback method?

Mccourt.cordingley1372837951:
Hi David

All the code is contained within the same solution, no module calls are made.
My code is declared in a scope of the same solution started as a headless client hence i am stumped.

If that’s the case then, without testing I suspect that only global and form methods are available to headless client. These work for sure:

// Method on a form set with setMainForm(formName)
String results = (String)servoy_hc.executeMethod(null, "aMethod", new Object[]{session, request});

// Method on a form passed in
String results = (String)servoy_hc.executeMethod("formName", "aMethod", new Object[]{session, request});

// Global method 
IDataSet results = (IDataSet)servoy_hc.executeMethod(null, "globals.aMethod", new Object[]{session, request});

Not sure about (and would be surprised if they did):

// Work?
IDataSet results = (IDataSet)servoy_hc.executeMethod(null, "scopes.scopeName.aMethod", new Object[]{session, request});

// Work?
IDataSet results = (IDataSet)servoy_hc.executeMethod(null, "globals.scopes.scopeName.aMethod", new Object[]{session, request});

For headless client work, we long ago started using forms to organize code available to the headless client. Kind of like a poor man’s “public” API organization. If you get scopes to work though, that would be ideal.

HI David

We have created a handler/routing function in the main globals scope to call the method we require in the new scope.
All we are doing is passing the parent scope name, object name and function name as parameters.

var pa = {paramsArr:paramsArr,parentScope:'services',parentObj:'METHODS',func:methodName}
h.queueMethod(null,'ROUTING',[pa],doCallBack)

and in main globals scope we have

function ROUTING(obj){
return scopes[obj.parentScope][obj.parentObj][obj.func](obj.paramsArr)
}

But it feels a bit hacky to me.

We use scopes to call a method in the headless client like this:

underlying method is called from a form!

fv_headlessclient = plugins.headlessclient.createClient("mod_DM_server",null,null,null);
if (fv_headlessclient != null && fv_headlessclient.isValid()) {
fv_headlessclient.queueMethod(null, "scopes.modDMserver.mod_DM_server_sendMails", [vObj], doDone);
}

the callback-method is: doDone, which is also present on the form.
this works fine here.

Cool, so scopes work. Sounds like just need to play around with where to put the callback method. Too bad specifying the callback method isn’t done the same way as specifying the trigger method. Would make all the routing a lot easier to figure out.