Skip to main content
Known Participant
Oct 5, 2021 8:16 AM UTC
Question

email id

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! 

    4 replies

    harshas2775
    Brainy
    Oct 5, 2021 10:10 AM UTC

    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",
    "")
    )
    }
    )
    )

    Happy to help. Even happier to optimize.
    Known Participant
    Oct 6, 2021 12:09 PM UTC

    Thank you for your reply .

    But this method is not working. Can you / anyone suggest any other method

    mikes0011
    Brainy
    Oct 6, 2021 3:19 PM UTC

    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?

    The Expression Guru