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?
var timerModel = new mm();<br> timerModel.objectName = 'Process_Log__c';<br> timerModel.id = "Timer";<br> timerModel.doQuery = true;<br> timerModel.preventUnloadIfUnsavedChanges = false;<br> timerModel.recordsLimit = 0;<br> timerModel.fields = f<br> { <br> id: 'Start',<br> uiOnly: true,<br> displaytype: 'DATETIME',<br> ogdisplaytype: 'TEXT',<br> label: 'Start',<br> defaultvaluetype: 'fieldvalue',<br> defaultValue: 'NOW',<br> readonly: true,<br> },<br> { <br> id: 'ElapsedMinutes',<br> uiOnly: true,<br> readonly: true,<br> displaytype: 'FORMULA',<br> ogdisplaytype: 'TEXT',<br> label: 'Elapsed Minutes',<br> returntype: 'DOUBLE',<br> precision: 3,<br> scale: 0,<br> formula: f{formula: '(NOW() - {{Start}}) / (1000*60)'}]
},<br> { <br> id: 'ElapsedSeconds',<br> uiOnly: true,<br> readonly: true,<br> displaytype: 'FORMULA',<br> ogdisplaytype: 'TEXT',<br> label: 'Elapsed Seconds',<br> returntype: 'DOUBLE',<br> precision: 2,<br> scale: 0,<br> formula: f{formula: '({{ElapsedMinutes}} - FLOOR({{ElapsedMinutes}}))*60'}]
},<br> { <br> id: 'PrettyTime',<br> uiOnly: true,<br> readonly: true,<br> displaytype: 'FORMULA',<br> ogdisplaytype: 'TEXT',<br> label: 'Pretty Time',<br> returntype: 'TEXT',<br> formula: f{<br> formula: 'FLOOR({{ElapsedMinutes}})+":"+IF(LEN(ROUND({{ElapsedSeconds}})) = 1 ,'+<br> ' "0"+ROUND({{ElapsedSeconds}}) , ROUND({{ElapsedSeconds}}))'<br> }]
},<br> { <br> id: 'Color',<br> uiOnly: true,<br> readonly: true,<br> displaytype: 'FORMULA',<br> ogdisplaytype: 'TEXT',<br> label: 'Color',<br> returntype: 'TEXT',<br> formula: f{<br> formula: 'IF({{ElapsedMinutes}}>'+mintues3+', "'+color3+'",'+<br> ' IF({{ElapsedMinutes}}>'+minutes2+', "'+color2+'",'+<br> ' IF({{ElapsedMinutes}}>'+minutes1+', "'+defaultColor+'","'+color1+'")))'<br> }]<br> }<br> ];
Where have I gone wrong?