how do i get IDs from ACS call

You must Login before you can answer or comment on any questions.

hi,

i am working on a moblie app with ACS in titanium studio and i want to get id from a query. i want my code to perform something like this:

function getUserID(){
var id;
    Cloud.Users.query({
            page: 1,
            per_page: 10,
            where: {
                age: { '$gt': 28 },
            }
        }, function (e) {
            if (e.success) {
            id=e.users[1].id;   
            } else {
                alert('Error:\\n' +
                    ((e.error && e.message) || JSON.stringify(e)));
            }
        });
    return id;
}
i understand i cannot do that. is there another way to do it? i thought about doing it with Titanium.App.Properties but it doesnt seem right.

thanks, ron

— asked 11 months ago by ron kerbs
0 Comments

1 Answer

function getUserID(callback){
 
    Cloud.Users.query({
            page: 1,
            per_page: 10,
            where: {
                age: { '$gt': 28 },
            }
        }, function (e) {
            if (e.success) {
            callback(e.users[1].id);   
            } else {
                alert('Error:\\n' +
                    ((e.error && e.message) || JSON.stringify(e)));
            }
        });
 
}
then
getUserId(function(id){
    alert(id);
});

Your Answer

Think you can help? Login to answer this question!