My additionalConditions on createRow not Working!?!?!

  • 1
  • Problem
  • Updated 2 years ago
  • Not a Problem
What's wrong with this? Having issues setting the values using additionalConditions property. All the fields are triple checked to be included in all models. Values are showing on this.Id and children.data[0].Id when setting breakpoints.

Rows get created without fields placed in additionalConditions property.

var params = arguments[0],
    parents = skuid.$M('parents'),
    children = skuid.$M('children'),
    grandchildren = skuid.$M('grandchildren'),
    $ = skuid.$;
    
$.each(parents.getRows(), function (){
    children.createRow({
        additionalConditions:[
            {parent: this.Id}
        ]
    });
    grandchildren.createRow({
        additionalConditions:[
            {parent: children.data[0].Id}
        ]
    });
});
Photo of Pat Vachon

Pat Vachon, Champion

  • 45,236 Points 20k badge 2x thumb

Posted 2 years ago

  • 1
Photo of Pat Vachon

Pat Vachon, Champion

  • 45,236 Points 20k badge 2x thumb
Skuid Version 10.0.10

Setting Conditions prior to createRow works without issue.
Photo of Zach McElrath

Zach McElrath, Employee

  • 54,256 Points 50k badge 2x thumb
Your syntax for additionalConditions is wrong. Your Conditions need to be formatted like this:

{ field: "Parent", value: this.Id }

or like this:

{ field: "Parent", value: children.data[0].Id }

assuming that "Parent" is the name of the field.
Photo of Pat Vachon

Pat Vachon, Champion

  • 45,236 Points 20k badge 2x thumb
Oh my ... been in too many Skuid pages this week. Oiy!
Photo of Pat Vachon

Pat Vachon, Champion

  • 45,236 Points 20k badge 2x thumb
Wait one sec... I accidentally deleted some parts to the snippet in making it generic. This is the snippet in it's entirety.

var params = arguments[0],
    PSRPackagesSelected = skuid.$M('PSRPackagesSelected'),
    NewTrackers = skuid.$M('NewTrackers'),
    NewPSRTrackerTasks = skuid.$M('NewPSRTrackerTasks'),
    TrackerSettings = skuid.$M('TrackerSettings'),
    $ = skuid.$;

$.each(PSRPackagesSelected.getRows(), function (){
    NewTrackers.createRow({
        additionalConditions:[
            { field: "PSR_Tracker__c", value: this.Id }
        ]
    });
    NewPSRTrackerTasks.createRow({
        additionalConditions:[
            {field: "WhatId", value: NewTrackers.data[0].Id},
            {field: "Subject", value: 'Confirmation of distribution of portfolio summary reports<https://abacusplanninggroup--skuid.na88.visual.force.com/00T1Y00003mjjiKUAQ>'},
            {field: "ActivityDate", value: TrackerSettings.getFirstRow().PSR_Date__c + '-01'},
            {field: "Type", value: 'To-Do'},
            {field: "OwnerId", value: '005i0000006RUE5AAO'}
        ]
    });
});
Photo of Mubeena

Mubeena

  • 278 Points 250 badge 2x thumb
HI ,
use this syntax  
var myModelAccount = new skuid.model.Model({
           dataSourceName: "Ui-Only"
       });
myModelAccount.createRow({ additionalConditions: [{field:'Name',value:'Test'},{field:'Type',value:'Prospect'},{field:'Description',value:'Something'} ],
                    doAppend: true
                });
myModelAccount.save();
Photo of Zach McElrath

Zach McElrath, Employee

  • 54,256 Points 50k badge 2x thumb
@Pat is there a particular condition that's not getting applied? Or are all of them not getting applied?
Photo of Pat Vachon

Pat Vachon, Champion

  • 45,236 Points 20k badge 2x thumb
Here's the working snippet. Old snippet seemingly didn't like "thid.Id". 



var params = arguments[0],
    pSRPackagesSelected = skuid.$M('PSRPackagesSelected'),
    newTrackers = skuid.$M('NewTrackers'),
    newPSRTrackerTasks = skuid.$M('NewPSRTrackerTasks'),
    trackerSettings = skuid.$M('TrackerSettings'),
    $ = skuid.$;

$.each(pSRPackagesSelected.getRows(), function (r,row){
    newTrackers.createRow({
        additionalConditions:[
            {field: "PSR_Package__c", value: row.Id},
            {field: "PSR_Date__c", value: trackerSettings.getFirstRow().PSR_Date__c}
            
        ]
    });
    newPSRTrackerTasks.createRow({
        additionalConditions:[
            {field: "WhatId", value: row.Unit__c},
            {field: "PSR_Tracker__c", value: newTrackers.data[0].Id},
            {field: "Subject", value: 'Confirmation of distribution of portfolio summary reports - ' + newTrackers.data[0].PSR_Package__r.PSR_Letter_Name__c},
            {field: "ActivityDate", value: trackerSettings.getFirstRow().Date_Sent__c},
            {field: "Type", value: 'To-Do'},
            {field: "OwnerId", value: '005i0000006RUE5AAO'}
        ]
    });
});