I’m trying to use the idea in this post to pull values when an account field is updated into a page that will be used to create a custom object, but am getting mixed results. Ultimate goal is to pull in values from a multi-select picklist from the account object, but for now, I’m just trying to understand what is happening.
Here’s a subset of Barry’s code from the post above.
skuid.snippet.registerSnippet('handleAccountChange', function(field, value) { console.log(field.row);
var acctCity = field.model.getFieldValue(field.row, 'Account.BillingCity')
, acctCountry = field.model.getFieldValue(field.row, 'Account.BillingCountry')
, formulaValue = acctCity + ' ' + acctCountry;
// update the formula field with the new value
field.model.updateRow(field.row, 'TestFormula\_\_c', formulaValue);
});
Output of console.log(field.row) shows BillingCity and BillingCountry associated with the object
Here’s the code in my page:
skuid.snippet.registerSnippet('handleDefaultPkg', function(field, value) { var acctCity = field.model.getFieldValue(field.row, 'Account\_\_r.BillingCity', true),
acctCountry = field.model.getFieldValue(field.row, 'Account\_\_r.BillingCountry', true),
acctCode = field.model.getFieldValue(field.row, 'Account\_\_r.Account\_ID\_\_c', true),
pkgDefault = acctCity + '-' + acctCountry + '-' + acctCode;
console.log(field.model);
console.log(pkgDefault);
// update the formula field with the new value
field.model.updateRow(field.row, 'Instructions\_\_c', pkgDefault);
});
Output of console.log(field.row) does not show BillingCity or BillingCountry. Only Account_ID__c is seen.
Final result of my version puts snull-null-ABC123] into the Instructions__c field.
Why are some fields from the object included/accessible and others not?