Support Topics Documentation Slack YouTube Blog

Get ownerID data (all data of user)

Hi ,

I’m new to backendless and starting to get into it (and having fun i must say…).

im trying to create a client datatable with the datatablesjs plugin in client side.

The thing is that when i’m getting data from ajax call to the table i need the OwnerID details (not just the ownerid itself - e.g i want all data in table and the first name of the user who created the data object) - but i get only the “ownerId” How can i get the ownerID full details.

Thanks for help

Hi @amiram_amsalem

You should make a separate request to the Users table and find the entity with a specified ownerId.
Here is the documentation for searching with the whereClause: https://backendless.com/docs/js/data_search_with_where_clause.html

Best Regards,
Maksym

Thanks for the solution

the thing is that i’ve put the function you wrote before and than i put it in the datatablesjs plugin and it’s take to much time to retrive ths user details see example:

in the code i’m building the columns via ajax call and each column i need to do another call for getting the user first name and it’s just to slow (i have 3000 rows so i need to do 3000 times call for getting only the user private name…):

$('#example23').DataTable({
responsive: true,
dom: 'Bfiprt',
"deferRender": true,
 "ajax" : { "url": "https://api.backendless.com/xxxxx-xxxx-xxxx-xxxx-xxxxxx/xxxxxx/data/Requests",
                "dataSrc": ""
              },
			  
 columns : [
  { "data" : "RequestStatus"},
  {
	"data": "ownerId",
	render: function ( data ) {
		var FirstName;
		Backendless.Data.of( "Users" ).findById( {objectId:"D6F3AF52-B973-D8D5-FF50-C2159A9F1A00"})
		 .then( function( result ) {
			 FirstName = result.FirstName;
		  });
		return FirstName;
	}	
  },
  { "data" : "RequestStatus"},
  { "data" : "RequestAmount"},
  { "data" : "Clientname"},
  { "data" : "JobDescription"},
  { "data" : "created"}	  

Any Suggestions why it’s so slow? or any other idea?

Okay, let me take a look and try to find the solution for this, @amiram_amsalem

As an option, you can retrieve all the users (max objects per request = 100, so if you have for example 200 users, you need to do only 2 requests). Then save users array locally and get the user by row’s ownerId.