I have used Wizard component for adding a new record.
But I need to check the recode which exist in the system or not.
So I have created below code.Currently I am fetching first name,middle name,last name and birth date from AddContact model.
But I need this data from wizard form.I need all value which i have currently entered.
Please help me to get this values.
var params = arguments[0],
step = params.step,
stepEditor = step.editor,
$ = skuid.$;
stepEditor.clearMessages();
var contactModel=skuid.model.getModel("AddContact");
var raw=contactModel.getFirstRow();
var Firstname="";
var Middlename="";
var LastName="";
var Birthdate="";
Firstname=raw.FirstName;
Middlename=raw.MiddleName;
LastName=raw.LastName;
Birthdate=raw.Birthdate;
var Name='';
if(Firstname!==undefined)
{
Name+=Firstname;
}
if(Middlename!==undefined)
{
Name+=' '+Middlename;
}
if(LastName!==undefined)
{
Name+=' '+LastName;
}
if(Firstname===undefined || LastName===undefined){
alert('Please Enter First Name, Last Name');
return false;
}
var Agcontact=skuid.model.getModel(“Agcontact”);
Agcontact.doQuery=false;
Agcontact.updateData();
if(Firstname!==undefined){
var FirstNamecondition = Agcontact.getConditionByName(‘FirstName’);
Agcontact.setCondition(FirstNamecondition,Firstname,true);
}
if(Middlename!==undefined){
var Middlenamecondition = Agcontact.getConditionByName(‘MiddleName’);
Agcontact.setCondition(Middlenamecondition,Middlename,true);
}
if(LastName!==undefined){
var LastNamecondition = Agcontact.getConditionByName(‘LastName’);
Agcontact.setCondition(LastNamecondition,LastName,true);
}
if(Birthdate!==undefined){
var bd=new Date(Birthdate);
var ageDifMs = Date.now() - bd.getTime();
var ageDate = new Date(ageDifMs); // miliseconds from epoch
var age=Math.abs(ageDate.getUTCFullYear() - 1970);
if(age<18){
alert(“Candidate’s age is less than 18”);
}
var Birthdatecondition = Agcontact.getConditionByName(‘Birthdate’);
Agcontact.setCondition(Birthdatecondition,Birthdate,true);
}
//Agcontact.recordsLimit=1;
skuid.model.updateData(/Agcontact]);
Agcontact.doQuery=true;
Agcontact.updateData();
console.log(params);
console.log(params.row);
console.log(Agcontact.soql);
console.log(Agcontact.getRows());
try{
if(Agcontact.getRows().length>0)
{
var messages = ;
var msg = ;
msg.message=Name+’ is already registor.Do you want to continue?..Click me’;
msg.severity=‘WARNING’;
messages.push(msg);
if (messages.length) {
var r = confirm(Name+’ is already registor’);
if (r === true) {
return true;
} else {
stepEditor.handleMessages(messages);
return false;
}
}
}
}catch(e){
}