Jamie Steiner
Posts: 0
Joined: Sun Jun 01, 2014 10:06 am

Additional user parameters

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.

Kateryna Grynko
Posts: 0
Joined: Thu Nov 15, 2012 9:13 am

Additional user parameters

Hi Jamie,

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

Jamie Steiner6905824
Posts: 0
Joined: Sun Jun 01, 2014 10:16 am

Additional user parameters

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...

Evgene Karachevtsev
Posts: 12
Joined: Mon Apr 28, 2014 1:12 pm

Additional user parameters

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...

Evgene Karachevtsev
Posts: 12
Joined: Mon Apr 28, 2014 1:12 pm

Additional user parameters

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

Jamie Steiner6905824
Posts: 0
Joined: Sun Jun 01, 2014 10:16 am

Additional user parameters

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.

Jamie Steiner6905824
Posts: 0
Joined: Sun Jun 01, 2014 10:16 am

Additional user parameters

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

Jamie Steiner6905824
Posts: 0
Joined: Sun Jun 01, 2014 10:16 am

Additional user parameters

got it working, it was the session token

Evgene Karachevtsev
Posts: 12
Joined: Mon Apr 28, 2014 1:12 pm

Additional user parameters

Hello Jamie,

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

Matt6607699
Posts: 0
Joined: Sat Jan 25, 2014 7:18 am

Additional user parameters

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.

Return to “Issues”