I’m working on writing some tests… so I am writing a mock that can generate some records of the type I need to test
I added an is_Test__c field to the object I’m creating records for, its defaults to “unchecked”
When I create the records I pass an additional condition to set the value in the new record to true.
After I’ve created the 2 records I try to apply the condition that is_Test__c must be true to the model (which has the condition already… but the condition is set to default to “inactive”) and then return the model from my function
what I find is that the 2 new records have been created… and their is_Test__c is set to true… but that all the other records in the model are returned as well… and not just the 2 I want
this.teacher_specialty_day = skuid.model.getModel(‘Cal_Teacher_Specialty_Day’); this.teacher_specialty_day_one = teacher_specialty_day.createRow(
{
additionalConditions:
{ field: ‘is_Test__c’, value: true},
{ field: ‘Cal_Teacher__c’, value: this.teacher_object.Id},
{ field: ‘Cal_Specialty__c’, value: this.specialty_object.Id},
{ field: ‘Cal_Day_Of_Week__c’, value: this.day_of_week_one.Id}
], doAppend: true
}
);
this.teacher_specialty_day_two = teacher_specialty_day.createRow(
{
additionalConditions: t
{ field: ‘is_Test__c’, value: true},
{ field: ‘Cal_Teacher__c’, value: this.teacher_object.Id},
{ field: ‘Cal_Specialty__c’, value: this.specialty_object.Id},
{ field: ‘Cal_Day_Of_Week__c’, value: this.day_of_week_two.Id}
], doAppend: true
}
);
var test_condition = this.teacher_specialty_day.getConditionByName(‘is_Test__c’);
this.teacher_specialty_day.setCondition(test_condition,true);
return this.teacher_specialty_day;
so if i inspect the returned value in the console I see
- 29: Object
- Cal_Day_Of_Week__c: “a4HU000000000xnMAA”
- Cal_Day_Of_Week__r: Object
- Cal_Specialty__c: “a4GU00000008foEMAQ”
- Cal_Specialty__r: Object
- Cal_Teacher__c: “a3aU00000001W7uIAE”
- Cal_Teacher__r: Object
- End_AM_PM__c: “a4NU00000004Kn5MAE”
- End_AM_PM__r: Object
- End_Hour__c: “a4MU00000004JMjMAM”
- End_Hour__r: Object
- End_Minute__c: “a4LU00000008QWBMA2”
- End_Minute__r: Object
- Id: “a4KU00000008QPuMAM”
- Id15: “a4KU00000008QPu”
- Start_AM_PM__c: “a4NU00000004Kn5MAE”
- Start_AM_PM__r: Object
- Start_Hour__c: “a4MU00000004JMpMAM”
- Start_Hour__r: Object
- Start_Minute__c: “a4LU00000008QW0MAM”
- Start_Minute__r: Object
- attributes: Object
- is_Test__c: false
proto: Object
- 30: Object
- Cal_Day_Of_Week__c: “3”
- Cal_Specialty__c: “2”
- Cal_Teacher__c: “1”
- Id: “5”
- Id15: “5”
- is_Test__c: true
proto: Object
- 31: Object
- Cal_Day_Of_Week__c: “4”
- Cal_Specialty__c: “2”
- Cal_Teacher__c: “1”
- Id: “6”
- Id15: “6”
- is_Test__c: true
proto: Object
- length: 32