I'm creating a dynamic model with javascript for a custom component, and getting an error: "Unable to load Model(s) - JSON deserialization failed: Illegal value for primitive"
I think it has to do with the way I'm attempting to create ui-only formula fields in the model. Can someone take a look?
Where have I gone wrong?
I think it has to do with the way I'm attempting to create ui-only formula fields in the model. Can someone take a look?
var timerModel = new mm();
timerModel.objectName = 'Process_Log__c';
timerModel.id = "Timer";
timerModel.doQuery = true;
timerModel.preventUnloadIfUnsavedChanges = false;
timerModel.recordsLimit = 0;
timerModel.fields = [
{
id: 'Start',
uiOnly: true,
displaytype: 'DATETIME',
ogdisplaytype: 'TEXT',
label: 'Start',
defaultvaluetype: 'fieldvalue',
defaultValue: 'NOW',
readonly: true,
},
{
id: 'ElapsedMinutes',
uiOnly: true,
readonly: true,
displaytype: 'FORMULA',
ogdisplaytype: 'TEXT',
label: 'Elapsed Minutes',
returntype: 'DOUBLE',
precision: 3,
scale: 0,
formula: [{formula: '(NOW() - {{Start}}) / (1000*60)'}]
},
{
id: 'ElapsedSeconds',
uiOnly: true,
readonly: true,
displaytype: 'FORMULA',
ogdisplaytype: 'TEXT',
label: 'Elapsed Seconds',
returntype: 'DOUBLE',
precision: 2,
scale: 0,
formula: [{formula: '({{ElapsedMinutes}} - FLOOR({{ElapsedMinutes}}))*60'}]
},
{
id: 'PrettyTime',
uiOnly: true,
readonly: true,
displaytype: 'FORMULA',
ogdisplaytype: 'TEXT',
label: 'Pretty Time',
returntype: 'TEXT',
formula: [{
formula: 'FLOOR({{ElapsedMinutes}})+":"+IF(LEN(ROUND({{ElapsedSeconds}})) = 1 ,'+
' "0"+ROUND({{ElapsedSeconds}}) , ROUND({{ElapsedSeconds}}))'
}]
},
{
id: 'Color',
uiOnly: true,
readonly: true,
displaytype: 'FORMULA',
ogdisplaytype: 'TEXT',
label: 'Color',
returntype: 'TEXT',
formula: [{
formula: 'IF({{ElapsedMinutes}}>'+mintues3+', "'+color3+'",'+
' IF({{ElapsedMinutes}}>'+minutes2+', "'+color2+'",'+
' IF({{ElapsedMinutes}}>'+minutes1+', "'+defaultColor+'","'+color1+'")))'
}]
}
];
Where have I gone wrong?