Skip to main content

I am setting the condition of an account-based model via a row action on a table of account records.  It works the first time, but when I click the row action a second time on a different account record the condition does not appear to update - it keeps the last condition.  What do I need to do to clear the condition and pass it a new value?  

My actions are as follows:

Activate and Set Value of Condition
Block UI
Query All Models
Unblock UI

I have tried adding “Deactivate Model Condition”, “Cancel Model”, “Empty Model Data” prior to the “Activate and set…” action and a separate “Query Model” just for the model I am changing.  

Models:

Accounts  <---- lists accounts in table
SelectedAccount  <----- table row action sets condition on this model
ModelsBasedOffOfSelectedAccount  <---- Related data to Selected Account  

 

Peter,

How have you set up your condition? It may be an issue with how you’re passing the value to the condition.


I have used condition like below. --------------------------- var params = arguments[0], step = params.step, stepEditor = step.editor, $ = skuid.$; stepEditor.clearMessages(); var contactModel=skuid.model.getModel(“AddContact”); //contactModel.updateData(); var raw=contactModel.getFirstRow(); var Firstname2=raw.FirstName; var Middlename2=raw.MiddleName; var LastName2=raw.LastName; var Birthdate2=raw.Birthdate; var Name=‘’; if(Firstname2!==undefined) { Name+=Firstname2; } if(Middlename2!==undefined) { Name+=’ ‘+Middlename2; } if(LastName2!==undefined) { Name+=’ ‘+LastName2; } if(Firstname2===undefined || LastName2===undefined){ alert(‘Please Enter First Name, Last Name’); return false; } var Agcontact=skuid.model.getModel(“Agcontact”); //Agcontact.doQuery=true; //Agcontact.updateData(); if(Firstname2!==undefined){ alert(Firstname2+’–ROhit’); var FirstNamecondition = Agcontact.getConditionByName(‘FirstName’); Agcontact.setCondition(FirstNamecondition,‘’,true); Agcontact.setCondition(FirstNamecondition,Firstname2,true); } if(Middlename2!==undefined){ var Middlenamecondition = Agcontact.getConditionByName(‘MiddleName’); Agcontact.setCondition(Middlenamecondition,‘’,true); console.log(Agcontact.soql); Agcontact.setCondition(Middlenamecondition,Middlename2,true); } if(LastName2!==undefined){ var LastNamecondition = Agcontact.getConditionByName(‘LastName’); Agcontact.setCondition(LastNamecondition,‘’,true); Agcontact.setCondition(LastNamecondition,LastName2,true); } if(Birthdate2!==undefined){ var bd=new Date(Birthdate2); 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,‘’,true); Agcontact.setCondition(Birthdatecondition,Birthdate2,true); } skuid.model.updateData(iAgcontact]); Agcontact.doQuery=true; Agcontact.updateData(); console.log(Agcontact.soql); alert(Agcontact.getRows().length); 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){ }


Reply