Page 1 of 2

Additional user parameters

Posted: Mon Jun 02, 2014 7:04 pm
by Jamie Steiner

Because of this post:
https://getsatisfaction.com/apperyio/...

I created a special service to return additional user data that I need (user Group, which is an additional string column in the _users collection)

My request includes the following code:

var UserID = localStorage.getItem('UserID');
var temp = {"_id": UserID};
return temp;

which works, because the app alerts the correct UserID (which stores the users _id locally)

and the response is mapped thus:
Image

Unfortunately the Group variable returns null. I executed the service in several places, and created a custom JS call to check it.


Additional user parameters

Posted: Mon Jun 02, 2014 8:43 pm
by Kateryna Grynko

Hi Jamie,

Replace:prevar temp = {"id": UserID};/preWith:prevar temp = '{"id": "'+UserID+'"}';/pre


Additional user parameters

Posted: Tue Jun 03, 2014 6:27 am
by Jamie Steiner6905824

Hi, sorry, but that isn't the problem. The UserID returns fine with both my syntax and yours. The problem is that the Group variable from the response is not created, or the expected value stored. I verified in console that "Group" is not created, despite being listed in the local storage variables list.

More info, I tested the service with a session token, and retrieved a valid response containing the desired info (see attached). I automatically created the service response from this test response. However, mapping the "Group" field to a local variable, still doesnt work. Image

Additionally, its strange that I get Null, but dont see the variable in the console. I think I should be getting undefined if its not there...


Additional user parameters

Posted: Tue Jun 03, 2014 7:27 am
by Evgene Karachevtsev

Hello Jamie,

Could you please give us public link to your application and write steps how to reproduce your problem: http://devcenter.appery.io/documentat...


Additional user parameters

Posted: Tue Jun 03, 2014 9:17 am
by Evgene Karachevtsev

Jamie,

Please tell, why don't you use rest service only for one user?:
http://devcenter.appery.io/documentat...

This rest can look like this example and you can simply map your local storage variable to reguest param "_id" without any javascript code.
http://prntscr.com/3p7rl7
http://prntscr.com/3p7rn8


Additional user parameters

Posted: Tue Jun 03, 2014 9:48 am
by Jamie Steiner6905824

I'll give it a whirl. Might have been helpful to explicitly point out in the documentation that urls can accept tokens ie. {_id}. Maybe it's obvious to some, but at least to me, it was not.


Additional user parameters

Posted: Tue Jun 03, 2014 7:34 pm
by Jamie Steiner6905824

I get the same result: null. I invoke the service after login, and checked it by running some JS on the next page (I only have two). There, I have an event to pull the local variable, and alert it. When I retrieve another local var, it works, but Group seems to be a problem still. Granted, your single user service is cleaner, but only helps if I can get it working.

Image Image Image


Additional user parameters

Posted: Wed Jun 04, 2014 4:32 am
by Jamie Steiner6905824

got it working, it was the session token


Additional user parameters

Posted: Wed Jun 04, 2014 8:31 am
by Evgene Karachevtsev

Hello Jamie,

Thank you for the update. Do not hesitate to contact us if you need any further help.


Additional user parameters

Posted: Thu Aug 21, 2014 9:01 pm
by Matt6607699

I have had a query that worked but no longer does for some reason. I am trying to list the pointer parentId but it doesn't return any results.

I have tried:
return '{"projectID":{"collName":"Projects","id":"'+value+'"}}';
return {"projectID":{"collName":"Projects","id":value}};
Image Image Image Image

Project name is ProFlow

a rel="nofollow"http://appery.io/app/mobile-frame?src=h ... e=mobile/a

username: mark
pass: 1234
click the upper left gear icon. choose login
if login button doesn't work click on add user.
possibly hit refresh
login
click contacts
this should load on contacts.