Skip to main content
Nintex Community Menu Bar
Question

how to read model's field value dynamically

  • July 10, 2024
  • 3 replies
  • 12 views

Forum|alt.badge.img+4

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?

This topic has been closed for replies.

3 replies

Forum|alt.badge.img+20
var params = arguments[0], yourModel = skuid.$M('YOURMODELID'), row = yourModel.getFirstRow(), yourDesiredValue = row.YourFieldName__c, $ = skuid.$; console.log(yourDesiredValue);<br>

Forum|alt.badge.img+4
  • Author
  • July 10, 2024

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.


Forum|alt.badge.img+4
  • Author
  • July 10, 2024

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>