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

Is there a way to notify a user if they try to create something that they have already created based on one certain colu

I have a form that a user fills out and it saves it in the database. They assign a specific name to it so is it possible to have a notification to let them know that that have already created something with that name?

Alena Prykhodko
Posts: 0
Joined: Tue Apr 09, 2013 7:36 am

Is there a way to notify a user if they try to create something that they have already created based on one certain colu

Hello,

It would need to be implemented in your app logic. For example, you could check if such record already exists in the database and then call the create service in your JavaScript.

These threads should be useful: https://getsatisfaction.com/apperyio/...
https://getsatisfaction.com/apperyio/...

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

Is there a way to notify a user if they try to create something that they have already created based on one certain colu

I tried looking through those but I don't really understand. In the create service, should I map something to a where parameter?

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

Is there a way to notify a user if they try to create something that they have already created based on one certain colu

Hello Ellen.

Create service only creates entity in DB, it doesn't do anything else.
If you want to check one or many columns on their uniqueness, then you need before each calling create service invoke FIND(query) service with where parameter , where you can check input value

1) Add query service to the page
2) add js to where parameter
3) on success event for query service add js
if (data.length == 0) {
createService.execute({});
}

Code above will check if result is 0 , thus entity with such name wasn't found, this means you can call your create service.
Don't forget to write real name of your service on the page

Note:
createService.execute({}); - this line will invoke your create service with mapping

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

Is there a way to notify a user if they try to create something that they have already created based on one certain colu

Hi Ellen,

You should use there custom JS that will form filter that you need to make sure your collection contains goal item or not..

Regards.

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

Is there a way to notify a user if they try to create something that they have already created based on one certain colu

So use this JS:
if (data.length == 0) {
createService.execute({});
}
and it goes in the 'where' parameter of the before send of my create service?

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

Is there a way to notify a user if they try to create something that they have already created based on one certain colu

Hi Ellen,

Nope, this code should be placed in "list/query" service "Success" event.

It will invoke "createService" after you list service will get 0 items as result.

Regards.

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

Is there a way to notify a user if they try to create something that they have already created based on one certain colu

But I want it to prevent the user from creating an additional item and alert them about it.

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

Is there a way to notify a user if they try to create something that they have already created based on one certain colu

Hello Ellen,

We completely understand your situation. But to prevent the user from creating an additional item you will need to consistently implement 2 steps:

  1. add js to the where parameter of the FIND(query) service, this js have to realize searching by user inputted data
  2. on success event for query service add js
    if (data.length == 0) {
    createService.execute({});
    }
    where data will contain the result of searching in the where parameter of the FIND(query) service. if your data will empty, it means that user inputted is unique and you could create new user.

Return to “Issues”