How to get results of API calls in CBL

I’m trying to assign a user role using CBL and I know that async calls spawning another thread are no longer supported in CBL.

Backendless.UserService.assignRole("", "TestingSubscribers", new AsyncCallback<Void>() {


			public void handleResponse(Void arg0) {

				debug("TestAssignUserRoleTimer#assignRole: handleResponse succeed: " + arg0);



			public void handleFault(BackendlessFault backendlessFault) {

				error("TestAssignUserRoleTimer#assignRole error: " 

						+ backendlessFault.getMessage()

						+ " (" + backendlessFault.getCode() + "): "

						+ backendlessFault.getDetail()




so of course I get this error:

11/27/15 6:10 PM ERROR com.backendless.digitalcopel.timers.TestAssignUserRoleTimer TestAssignUserRoleTimer#assignRole error: You have no permission to thread manipulation (IllegalArgumentException): null

so I know the solution is to use Backendless.UserService.assignRole("", “TestingSubscribers”);

but I want to know the result of the call, i.e. whether it succeeded or failed. How can I do this in CBL?

Forgot to add, is doing a try { } catch the only way to check for errors?

Hi, Simon.

Have you tried logging the result?

public void execute( String appVersionId ) throws Exception 
 LogBuffer.getInstance().setLogReportingPolicy( 1, 0 ); 
 Logger log = Logger.getLogger( YOUR_CLASS.class ); 
 Backendless.UserService.assignRole("", "TestingSubscribers"); ; "Role assigned"); 
 catch ( Throwable t ) 
 log.error( "Error assigning role", t ); 
 throw new RuntimeException( t ); 



I see, this is the new way to use the Logging service. Excellent.
I guess I have an older version of CodeRunner installed because Backendless.UserService.assignRole is a void function that doesn’t return anything. I’ll try this! Thanks,

Hi, Simon,

It truly returns void, I have updated my answer.

Good luck,