Skip to main content

I am trying to get a field value using javascript but data.0 is giving error.


Please suggest if the 0 is causing Uncaught SyntaxError: Unexpected number.


cmodel = skuid.runtime.getPage('RSS_Support_Mainpage__v2').model.getModel('DialPad')
//Ye {_parentPageId: 'sk-2n8w-14', dataSourceName: 'salesforce', dataSource: E, processOnClient: true, id: 'DialPad', …}
cmodel.data.length
//1
cmodel.data.0.Description
//VM6472:1 Uncaught SyntaxError: Unexpected number

Hello Dinesh,


Since this is in Javascript you need to do cmodel.data[0].Description.


Or another approach:


let firstRow = cmodel.getFirstRow();
firstRow.Description;



lukaspovilonis:


cmodel.data[0].Description



Thanks lukaspovilonis.


The first approach to get the row context in array using isn’t working.
image


However, the second approach worked to get the first row and fetch value.


Thanks again for your time and help.


I’m glad the 2nd way worked. Regarding the 1st way, try removing . before e0].


Instead of cmodel.data.a0], do the following, cmodel.datat0]


All good.


It worked, thanks for your time and help!


Reply