SHARE
TWEET

Untitled

tototototo123 Jul 22nd, 2019 53 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. private String checkFieldsValue() {
  2.         system.debug('### START checkFieldsValue');
  3.         String result;
  4.  
  5.         if (String.isBlank(email) || String.isBlank(messageText) || String.isBlank(country) || String.isBlank(language) || String.isBlank(emailConfirmation)
  6.                 || String.isBlank(selectedTopic) || String.isBlank(selectedTopic2)) {
  7.             system.debug('## Field validation fail : Empty Field');
  8.             result = Label.ErrorRequiredFieldMissing;
  9.         }
  10.         // Check if email and emailConfirmation are equal
  11.         if(email != emailConfirmation) {
  12.             system.debug('## Field validation fail : Incorrect Value between Email and Email Confirmation');
  13.             result = Label.ErrorDifferentEmails;
  14.         }
  15.         //Check if the User agreed to the conditions
  16.         if(agreeCondition == false) {
  17.             system.debug('## Field validation fail : Conditions Checkbox is not ticked');
  18.             result = Label.ErrorConditionAcceptance;
  19.         }
  20.         if(!Pattern.matches(Constants.REG_EMAIL, email)) {
  21.             system.debug('## Field validation fail : Incorrect Email');
  22.             result = Label.ErrorEmailField;
  23.         }
  24.         phoneOnlyNumber = phone.replaceALL('[^0-9]*', '');
  25.         if(String.isBlank(phoneOnlyNumber)) {
  26.             system.debug('## Field validation fail : Incorrect Phone');
  27.             result = Label.ErrorPhoneField;
  28.         }
  29.         if(firstName.length() > 40 || lastName.length() > 80 || messageText.length() > 32000) {
  30.             system.debug('## Field validation fail : Field value too long');
  31.             result = Label.ErrorFieldTooLong;
  32.         }
  33.         if(uploadImageFile1.VersionData != null && uploadImageFile1.Title != null){
  34.             result = FormUtils.checkFormAttachment(uploadImageFile1);
  35.         }
  36.         if(uploadImageFile2.VersionData != null && uploadImageFile2.Title != null){
  37.             result = FormUtils.checkFormAttachment(uploadImageFile2);
  38.         }
  39.         if(uploadImageFile3.VersionData != null && uploadImageFile3.Title != null){
  40.             result = FormUtils.checkFormAttachment(uploadImageFile3);
  41.         }
  42.         if(uploadImageFile4.VersionData != null && uploadImageFile4.Title != null){
  43.             result = FormUtils.checkFormAttachment(uploadImageFile4);
  44.         }
  45.         if(uploadImageFile5.VersionData != null && uploadImageFile5.Title != null){
  46.             result = FormUtils.checkFormAttachment(uploadImageFile5);
  47.         }
  48.  
  49.         system.debug('### END checkFieldsValue');
  50.         return result;
  51.     }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top