On form submission check if similar record exists
I want to run a check on each form submission. It should check all existing records on any matching records based on two fields, DOB and Last name. If a match is found it should send an email.
I think I am close but not exactly the right code. Can anyone help?
Tried this as a workflow on created on success:
- pnRecord = Register[ID != 0];
- for each pn in pnRecord
- {
- //fetch matching person records by DOB and last name
- pm = input.Date_of_Birth == pn.Date_of_Birth && input.Name.last_name == pn.Name.last_name;
- //if any found then send email
- if(pm.count() > 0)
- {
- sendmail
- [
- from :zoho.adminuserid
- to :zoho.adminuserid
- subject :"DOUBLE FOUND"
- message : input.Name
- ]
- }
- }
Probably goes wrong at line 6. Not sure how to properly code the count line.
Thanks