I have a form where a user needs to fill it. I have an email id field in it. So, now when a user enters the email I need to check whether the entered email id is already there in the records or not. If email id already presents it should throw an error in the interface saying "email id already exists".
Can anyone please let me know how to apply this scenario in my interface!
Discussion posts and replies are publicly visible
You can simply query your table, filtered based on the entered email Id. If any record is found (totalCount>0) then you can throw the validation.
E.G.
a!localVariable( local!checkEmailID:a!refreshVariable( value:a!queryentity( entity:cons!EXAMPLE_YOUR_ENTITY, query:a!query( filter:a!queryfilter( field:"emailId", operator:"=", value:local!emailIdInput), pagingInfo:a!pagingInfo(1,1))), refreshonVarChange:local!emailIdInput), a!sectionlayout( contents:{ a!textField( label:"Email ID", value:local!emailIdInput, saveInto:local!emailIdInput, validation:if( local!checkEmailID.totalCount>0, "Validation Message", "") ) } ) )
Thank you for your reply .
But this method is not working. Can you / anyone suggest any other method
When you say "not working", can you be more specific? Are you getting a particular error? What happens when you try? Can you post the current version of your code and/or some screenshots?
Its not working means like not working according to requirement . Its getting the total count of the email id .
But Thank you, @Harsha Sharma for replying . I used another approach where for the email field, I gave a validation where it checks from the DB directly and tells whether the email exists or no .