Model Conditioning

  • 1
  • Question
  • Updated 2 years ago
Not sure if this will work.  I can be passing 1 of 2 parms in the url.  The parms both work individually if I remove the other query  One value passed is call "Id" and the other is "Person_Id".  I tried using <conditions logic="(1 or 2)"> and each is set to "abort this models query"  I either pass the Id or Person_Id.  I would think the one not passed would yield the others result.  There can be no matches.

        <model id="Member_Selected" limit="1" query="true" createrowifnonefound="false" datasource="salesforce" type="" sobject="Member_DNA__c" doclone="">            <fields>
                <field id="Location__c"/>
                <field id="Location__r.Name"/>
                <field id="Location__r.Id"/>
                <field id="Name"/>
                <field id="Organization__c"/>
                <field id="Organization__r.Name"/>
                <field id="Organization__r.Id"/>
                <field id="Person__c"/>
                <field id="Person__r.Name"/>
                <field id="Person__r.Id"/>
                <field id="Id"/>
            </fields>
            <conditions>
                <condition type="param" value="Id" field="Id" operator="=" enclosevalueinquotes="true" novaluebehavior="noquery" state="" inactive="false"/>
            </conditions>
            <actions/>
        </model> 
        <model id="Phone_DNA_Entity" limit="20" query="true" createrowifnonefound="false" datasource="salesforce" type="" sobject="Phone_Numbers_DNA__c">            <fields>
                <field id="Id"/>
                <field id="Name"/>
                <field id="Connected_Member_DNA__c"/>
                <field id="Connected_Member_DNA__r.Name"/>
                <field id="Connected_Member_DNA__r.Id"/>
                <field id="Connected_Member_DNA__r.Location__c"/>
                <field id="Connected_Member_DNA__r.Location__r.Name"/>
                <field id="Connected_Member_DNA__r.Location__r.Id"/>
                <field id="Connected_Member_DNA__r.Person__c"/>
                <field id="Connected_Member_DNA__r.Person__r.Name"/>
                <field id="Connected_Member_DNA__r.Person__r.Id"/>
                <field id="Connected_Member_DNA__r.Organization__c"/>
                <field id="Connected_Member_DNA__r.Organization__r.Name"/>
                <field id="Connected_Member_DNA__r.Organization__r.Id"/>
                <field id="CreatedDate"/>
                <field id="DNT__c"/>
                <field id="Country_and_Phone__c"/>
                <field id="Connected_Phone__c"/>
                <field id="Connected_Phone__r.Name"/>
                <field id="Connected_Phone__r.View_Name__c"/>
                <field id="Connected_Phone__r.Id"/>
                <field id="Extension__c"/>
                <field id="Phone_Description__c"/>
                <field id="Phone_Used_Where__c"/>
                <field id="Primary_Entity_Phone__c"/>
                <field id="Primary_Sequence__c"/>
                <field id="Roll_Off_Date__c"/>
                <field id="Roll_Off_Reason__c"/>
                <field id="Search_Phone_Member__c"/>
                <field id="View_Country_Phone__c"/>
                <field id="View_Phone_DNA__c"/>
                <field id="Connected_Member_DNA__r.View_Member_Stacked__c"/>
                <field id="Connected_Member_DNA__r.View_Title_Department_Stacked__c"/>
                <field id="CreatedById"/>
                <field id="CreatedBy.Name"/>
                <field id="CreatedBy.View_Name__c"/>
                <field id="LastModifiedById"/>
                <field id="LastModifiedBy.Name"/>
            </fields>
            <conditions logic="(1 or 2)">
                <condition type="param" value="Person_Id" field="Connected_Member_DNA__r.Person__c" operator="=" enclosevalueinquotes="true" novaluebehavior="noquery" state="" inactive="false"/>
                <condition type="modelmerge" value="" field="Connected_Member_DNA__r.Person__r.Id" operator="=" model="Member_Selected" enclosevalueinquotes="true" mergefield="Person__r.Id" novaluebehavior="noquery" state="" inactive="false"/>
            </conditions>
            <actions/>
        </model>
Photo of Bill Fox

Bill Fox

  • 7,954 Points 5k badge 2x thumb

Posted 2 years ago

  • 1
Photo of Mark DeSimone

Mark DeSimone, Official Rep

  • 11,050 Points 10k badge 2x thumb
Hi Bill, can you share the URL you're using? There could be a syntax issue in that.
Photo of Barry Schnell

Barry Schnell, Champion

  • 18,086 Points 10k badge 2x thumb
Bill -

The reason it's not working is because you have the "no value" behavior set to "Abort Model Query."  Abort Model query will instruct Skuid to not run the model query at all if the value is missing so the result you are encountering is expected behavior.

Change your no value setting to "Deactivate Condition" and that should resolve your issue.

Keep in mind that if the page is provided both url params, you will get both records since your page is configured with a limit of 20.  Depending on your scenario, I would recommend adding an order by clause to your model just to help in that situation.  If this is a scenario you see could occur, there are other ways to configure your models to ensure consistent behavior or even fail if both params are provided.  I'm guessing you don't need that for your scenario but if you do, let me know.