GraphQL query error

Hello, I’m trying to make a query using graphiQL interface in the browser, I’m using the getTasks query but I’m getting an error saying:
Error trying to resolve getTasks
“Message”: “Object reference not set to an instance of an object.”

I’m writing the query like this
{
getTasks(taskType:“Preorders”) {
id
}
}

and graphQL is not showing an error in the query, please help! thank you

What samba version are you using? The task queries and mutations aren’t working in the latest version.

I’m using version 5.3.6, is it going to be fixed at some point?

I don’t know if samba devs will fix this issue soon, I haven’t upgraded because I use a lot task queries and mutations.

What version are you using? and can I downgrade?

I’m using 5.3.0 version

I dont know if doing this downgrade ‘hack’ would cause an issue in the future.

We are going to fix this issue. Our team is looking at it. @VehbiEmiroglu

We should discourage downgrading versions. It is never a good idea to downgrade to previous version.

To add to this, there’s more than just an entry in the VersionInfo table. Changes have been made to the database schema. If columns have been renamed, removed, data type changed there could be problems at runtime.

1 Like

If you HAVE to do it by GQL, then this won’t be viable but the same can be done through SQL query in script.
So the query itself would be:

 SELECT Id
 FROM Tasks
 JOIN TaskTypes ON TaskTypeId = TaskTypes.Id
 WHERE TaskTypes.Name = 'Preorders'

And in the script it would look something like:

var  query =  "SELECT Id " +
              "From Tasks " +
              "JOIN TaskTypes ON TaskTypeId = TaskTypes.Id " +
              "WHERE TaskTypes.Name = 'Preorders'"

To query you can put the sql.Query() in a try/catch block(which tries the query, and if there is an error, will display said error without crashing the program)

var result;
var isSuccessful = host.tryCatch
	(
	function(){
		result = sql.Query(qry).All;
	}, function(exception) {
		hostException = exception;
		return true;
	});
if (!isSuccessful){
	exceptionMessage = hostException.GetBaseException().ToString();
	dlg.ShowMessage(exceptionMessage);
}
return result;

This was allegedly fixed (getTasks) in the latest update but I still can’t get it to work. Does anyone have a very basic query for getTasks that is known to work that I can use to test my setup? For examples sake I have this ToDo list implemented in my setup. I just need a baseline query that I know works to get the structure of this thing down. :slight_smile:

Any help is appreciated!