Read Rol of the user from mobile app

Hello Community!


I need to read the roles of the user logged in the mobile app. I try with a query sql but I don't have any result (query is working from the sql console). There is any other better option for that?


var sqlText =
			"select u.contactid,, from  sysUserInRole ur  " +
			"inner join sysadminunit u on ur.sysUserId = inner join " +
			"sysadminunit rol on ur.SysRoleId = where u.contactid ='" + Terrasoft.CurrentUserInfo.contactId + "'";
		var me = this;
			sqls: [sqlText],
			success: function(data) {
				if (data.length > 0) {
					var records = data[0].rows;
					for (var i = 0, ln = records.length; i < ln; i++) {
						var sqlData = records.item(i);


Like 0



Hello Federico,


And have you tried using ESQ select query using the Terrasoft.CurrentUserInfo.contactId as a value for the ESQ filter? Please try this approach as well.


Best regards,


Oscar Dylan,

 Can you give me a example of this query using esq for mobile?

Federico Buffa,


I have no example, but the code should be similar to the one below:

var resultArray = [];
var esq = Ext.create("Terrasoft.EntitySchemaQuery", { rootSchemaName: "SysAdminUnitInRole" });
esq.filters.addItem(esq.createColumnFilterWithParameter(3, "SysAdminUnit", Terrasoft.CurrentUserInfo.userId));
esq.filters.addItem(esq.createColumnFilterWithParameter(4, "SysAdminUnitRole", Terrasoft.CurrentUserInfo.userId));
esq.getEntityCollection(function (result) {
	if (result.success && result.collection.getCount() > 0) {
		var item = result.collection.getByIndex(0);
}, this);

Best regards,


Oscar Dylan,

 I tried to add the esq query but Im getting error in the filters looks filters not exist in the esq. Im trying to add this in a custom BR. Any idea of the correct syntax?


If I check the esq properties for filters is undefined. As well I tried create a group filter to add it later to the esq but with no luck.


Any another idea of how to know the roles of the user in the mobile app?

Show all comments