Hi Multi Row Variable Set Validations

Gowtham29
Tera Expert

Hi Team,

There is a drop down variable as 'A' and 'B' in Multi Row Variable Set. If the user enter the entry as B first, system should not allow to create an entry in the MRVS, should alert on the form and need to abort action. Always user has to enter the entry as 'A' first. This MRVS should have only one entry for 'A', if the user try to make an entry for 'A', it should not allow.

Please let me know how to create this validation.

5 REPLIES 5

Manikmodi16
Tera Guru

Hi,

 

For the second part of your request to validate against duplicate entries in the MRVS, the below logic can be used:

//Below set of code is for validate any duplicate in Email in portal side

		if(g_service_catalog.parent)
		{
			var value1 = g_service_catalog.parent.getValue('MRVS_Name');     //Name of the MRVS
			if(value1 != '') {
				var arr1 = JSON.parse(value1);
				searchExisting(g_form.getValue("Field_Name"), arr1);     //Name of the field to check for duplicates
			}
		}
	}	

	function searchExisting(keyColumn, newArray) 
	{
		var flag = false;
		var mail = oldValue;
		if (mail == "") {
			if (newArray.length > 0) {
				for (var i = 0; i < newArray.length; i++) {
					if (newArray[i].Field_Name == newValue) {
						flag = true;
						break;
					}
				}
			}
		}
		else if (mail != "") {
			if(oldValue != newValue) {
				if (newArray.length > 0) {
					for (var j = 0; j < newArray.length; j++) {
						if (newArray[j].Field_Name == newValue) {
							flag = true;
							break;
						}
					}
				}
			}
		}

		if (flag == true) {
			g_form.clearValue('Field_Name');
			g_form.showErrorBox('MRVS_Name','The Email address "'+newValue+'" entered is already added. Please enter different email address.');
			flag = false;
			return false;
		}
		return false;
	}

 

Thanks,

Manik Modi

 

Please mark this reply as the solution if you find this helpful. Thanks!