Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Insert string value to a field of type decimal

JPSS
Tera Contributor

Hi,

 

Can we instert string value to an out of the box field of type decimal.

 

 

6 REPLIES 6

abirakundu23
Giga Sage

Hi @JPSS,

We cannot store "string" value to "Decimal field type" which will be troughing the validation error as data type mismatch. If we follow below approach, then will be able to store string as in Decimal field type.
I have tested in my PDI, please find below screenshots

abirakundu23_0-1720928031662.pngabirakundu23_1-1720928080896.png

abirakundu23_2-1720928102994.png

 

Best practice we can use string data type.

Please mark helpful & correct answer its worthy for you.

 

-O-
Kilo Patron

Depending on what you mean by "we insert" (do you mean using code, flow, something else?) you could create a Decision Table (which can be referenced/used from/in both code and flow) "converting" texts "Good", "Neutral" and "Bad" to numbers and store the numbers resulting from running the decision instead.