How to use Flow Designer with "Price" field - insert fails

Patrick Niessen
Giga Contributor

Hi,

I am using Flow designer to trigger *on insert* into a "transaction" table, and write some information from this table into another table, e.g.   target_table -> Company = trigger -> transaction table -> company  OK.  

This works completely fine for all field except the Price field (field type Price) and I don't understand why.  

target_table -> Price     =     trigger -> transaction table -> Price    insert takes place for all fields, but no data in the target table Price field

It appears the Price is not a simple field but stores data in another table?

For the moment I have switched to using the decimal field instead of the Price field, and this works, but I would prefer to have the correct field type, also because of the formatting.

Can someone please advise how to solve?

 

1 ACCEPTED SOLUTION

Patrick Niessen
Giga Contributor

The solution we found was to create a custom Action "CONVERT TO PRICE" and put that into the workflow before the insert/update.

find_real_file.png

find_real_file.png

 

find_real_file.png

View solution in original post

12 REPLIES 12

Hi Patrick,

I did that using Update Record Action; you can set it during the Create Record Action as well

don't drag and drop the data from the Data section to the fill; type in the text box

find_real_file.png

find_real_file.png

Mark Correct if this solves your issue and also mark 👍 Helpful if you find my response worthy based on the impact.
Thanks
Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Yes this works for me too if I always set the same value (as you have done).  Please note that I use the Pills to select the Price from the record in the other table, and insert it into the Price field of the other table.  This does not work.

Hi Patrick,

if that is the case then you can try to use script to set the value in that format

Regards
Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

It means Servicenow exhibits the same issue for you when you try it, i.e. you can't use flow designer pills to set the value?

 

Hi Patrick,

I haven't worked extensively on flow designer so cannot comment on that piece.

you can use flow designer pills to set the value but as you said it doesn't work well with price field; possibly it may or may not work for currency field as well

Not sure whether ServiceNow is aware of this.

The reason I think is if you get price value in background script for a particular record it only gives you the integer/float value and not the currency code

var gr = new GlideRecord('incident');
gr.get('af5cf0310794d010540bf2508c1ed094');

var price = gr.u_cost;

gs.info(price); -> prints 101 and not USD;101

The same logic might be used internally to get value from existing record if you use designer pills; so it might be picking only the int/float value and not the code; So I would recommend using script to set that particular field

Mark Correct if this solves your issue and also mark 👍 Helpful if you find my response worthy based on the impact.
Thanks
Ankur

 

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader