Friday 21 June 2024

Servicenow getvalue

 servicenow getvalue()




getValue()


https://www.servicenow.com/community/developer-blog/servicenow-importance-of-getvalue-and-getdisplayvalue-method/ba-p/2333471


The "getValue()" method returns a string representation of the data in the field. This is the safest way to ensure you are putting the proper data into the Array, or any other variable. The issue is found more often in code when data is pushed into an Array because you are typically looping through multiple records, hence changing the "view" of the data, but it can happen anywhere.




parseInt() on those that is integer, but getValue()  returned as string without parseInt(), "1" + 1 = "11"

https://www.servicenow.com/community/developer-forum/how-to-convert-field-value-from-string-to-integer/m-p/2501787

var intValue = parseInt(sourceValue);


No comments:

Post a Comment