Skip to main content

Explained:

Suppose I’ve a field name in a string variable and i need to read that field’s value from JavaScript. How do I do that?

var params = arguments[0], yourModel = skuid.$M('YOURMODELID'), row = yourModel.getFirstRow(), yourDesiredValue = row.YourFieldName__c, $ = skuid.$; console.log(yourDesiredValue);<br>

Thanks for the response.
That doesn’t solve my problem. I need to get the model’s field value, where my field name is stored in the String variable. I don’t want to hard code ‘YourFieldName__c’.
I need to get the field’s value by taking the field name dynamically from the string variable.


I found the solution for this, thought this might be helpful in the community so posting it.


var YourModel = skuid.model.getModel('YOURMODELID'); var row = YourModel.getFirstRow(); var fieldName = 'XYZ__c'; var yourDesiredValue = contactUs_UIOnlyData.getFieldValue(row,fieldName,true);<br>