0

I have a pointer in one of my Parse.com datastore objects. I need to extract the objectId from it. This is the json Customer object in my cloud code:

"Customer":{"__type":"Pointer","className":"_User","objectId":"oowk8Vgcyg"},

I tried

var customer = request.object.get("Customer")

This prints out [object Object].

Now how do I get the objectId from it? I tried

customer.objectId

or

customer[objectId]

or

customer["objectId"]

or the various with or without quotes

customer.get(objectId)

but none works. What's the correct syntax?

2
  • What is the result of console.log(request.object.get("Customer"))? Commented May 7, 2015 at 18:14
  • @howderek it's [object Object] Commented May 7, 2015 at 18:49

2 Answers 2

1

Try using customer.id

The Parse object looks different than the JSON you send.

https://www.parse.com/docs/js/guide#objects-retrieving-objects

Sign up to request clarification or add additional context in comments.

2 Comments

It comes as undefined.
The correct syntax is customer.id; I found it in the link you provided so if you add this to your answer I'll gladly accept it.
0

You can get it like this.

For example I want to get the objectId of the class User that has a pointer from another class

var userId = object.get('User').id;

hope it helps.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.