How to make alert and how to handle more then two unique fields

How to make alert and how to handle more then two unique fields

Hi, 

After the line 23 and 24 are added on a custom function, it got error "'ALERT' task can be used only in on load, on validate and on change actions". 

I want to remind user to key in the value to specified fields. How can I add it on custom function?

The main purpose I need to ensure there is duplicate entry for ID no (currently I need six unique fields). However, CRM only have two unique field, is there any better way to handle this application?

Thanks in advance, 
Br, Andy

  1. void CreateNonHKIDHolderID (int clientid string x2IDno string ChinaID string ChinaBirth string Passportstring x2IDtype )

  2. clientidstr=input.clientid.toString();
  3. x2IDno="";
  4. if(input.ChinaID.trim()  !=  "")
  5. {
  6. x2IDno=input.ChinaID.toString();
  7. x2IDtype="China ID";
  8. }
  9. else if(input.Passport.trim()  !=  "")
  10. {
  11. x2IDno=input.Passport.toString();
  12. x2IDtype="Passport";
  13. }
  14. else if(input.ChinaBirth.trim()  !=  "")
  15. {
  16. x2IDno=input.ChinaBirth.toString();
  17. x2IDtype="China Birth Cert";
  18. }
  19. else
  20. {
  21. alert "Please enter value on one of these field 'China ID', 'Passport' or 'China Birth Cert'";
  22. cancel submit;
  23. }
  24. txt2=input.x2IDno.getAlphaNumeric();
  25. txt3=input.x2IDtype;
  26. mp=map();
  27. mp.put("(b) ID no.",txt2);
  28. mp.put("(b) ID Type",txt3);
  29. update = zoho.crm.updateRecord(("Accounts"),clientidstr,mp);
  30. info mp;
  31. info update;