Ellen Schlechter
Posts: 0
Joined: Sun Aug 31, 2014 3:28 am

Is it possible to have the same button run both a create service and an update service?

The error is in this line of code.
var isCreated = data.length 0; // this expression will return true or false

Ellen Schlechter
Posts: 0
Joined: Sun Aug 31, 2014 3:28 am

Is it possible to have the same button run both a create service and an update service?

Now in addition to the error above, I get this.
Image Image

Yurii Orishchuk
Posts: 0
Joined: Fri Feb 14, 2014 8:20 am

Is it possible to have the same button run both a create service and an update service?

HI Ellen,

In this case - you have "data" variable with undefined value. Thus you have this problem.

Regards.

Ellen Schlechter
Posts: 0
Joined: Sun Aug 31, 2014 3:28 am

Is it possible to have the same button run both a create service and an update service?

What is that? I just used the code you gave me.

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

Is it possible to have the same button run both a create service and an update service?

Hello Ellen,

If where parameter in request hasn't valid value, response has in description "Incorrect query".

Code that support team provides, can be used as example and each case should be modified, there is no real use case, when you can copy code without changing/adding something.

Ellen Schlechter
Posts: 0
Joined: Sun Aug 31, 2014 3:28 am

Is it possible to have the same button run both a create service and an update service?

This is what I have. Should something be changed? Image

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

Is it possible to have the same button run both a create service and an update service?

Ellen,

1) Value from that javascript should be returned as a string, so the mapping could use it for you 'where' parameter
2) Instead of "hereisYourUserIdYouWantToTest", obviously ,you need to put id

Ellen Schlechter
Posts: 0
Joined: Sun Aug 31, 2014 3:28 am

Is it possible to have the same button run both a create service and an update service?

So I simply changed "hereisYourUserIdYouWantToTest" to "id" and it didn't change anything.

Egor Kotov6832188
Posts: 0
Joined: Wed Nov 19, 2014 5:15 pm

Is it possible to have the same button run both a create service and an update service?

Hello Ellen.
Id of each collection looks like "5489e282e4b05c4ac3be8869".
You are trying to search for users in your collection. Id(identifier) is a unique sequence of numbers and characters, that makes one item(entity) different to another within one collection or Database(depending on Database).
So you need somehow(local variable, mapping, component on the page) store it for users, and get one of them before sending request for searching user by it's id in this where parameter. Don't forget that you can't simply set where parameter value to user id, you need to point that it is column id and return it to the where parametr
IT IS JUST AN EXAMPLE, NOT YOUR USER'S ID
return '{"_id": "5489e282e4b05c4ac3be8869"}';

Ellen Schlechter
Posts: 0
Joined: Sun Aug 31, 2014 3:28 am

Is it possible to have the same button run both a create service and an update service?

Ohh now I understand! I already have an _id mapped to a label so would I just put the name of the label there?

Return to “Issues”