- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-17-2025 09:34 AM
I'm stuck on a flow i've created.
The basic function is to allow users to select multiple Hardware Assets at one time.
I can update the Asset and associated CI with no issues.
Now, I need to add all costs associated to each Asset and put that in the Flow Variable, so that i can update the Catalog variable for reporting.
I have a client script for a similar form that can do this.
var newPrice = unit.replace('$', '');
var existPrice = g_form.getValue("device_total_cost").replace('$', '');
var extendPrice = "";
extendPrice = Number(existPrice) + Number(newPrice);
//alert("Not sure why values are not adding. Unit = "+unit+", New Price = "+newPrice+", Exisitng Price = "+existPrice+" for total of "+extendPrice);
g_form.setValue('device_total_cost',"$"+parsefloat(extendPrice).toFixed(2));
I'm trying to avoid creating a custom Flow Action and thought to use the functions available to the Pill Record.
It's not working.
Code is
var origCst = fd_data._8__look_up_hardware_record.cost;//.replace("$","");
var origFVCst = fd_data.flow_var.cpu_ttl_cost;//.replace("$","");
var newTTL = origCst+origFVCst;
return "$"+parseFloat(newTTL).toFixed(2);
but i'm getting this error
If i just put the pill records together in the Flow Logic activity
I get this.
while this is acceptable for Serial numbers, the costs don't make sense.
Any suggestions on a solution.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-21-2025 07:35 AM
Can you try parseInt or parseFloat with mentioning base 10? It can be done. Like below if that works.
var a = '123';
var b = parseInt(a, 10);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-21-2025 05:59 AM - edited 01-21-2025 06:00 AM
Hi @EricG2 ,
Ok. Have you tried changing the script as shown and highlighted below?
var origCst = fd_data._8__look_up_hardware_record.record.cost
May be that '.record' is missing there.
If this address your question, please don't forget to mark this response correct by clicking on Accept as Solution and/or Kudos.
You may mark this helpful as well if it helps you.
Thanks,
Animesh Das
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-21-2025 07:14 AM
Getting closer, thanks.
It is still functioning as a concatenation.
I put in a gs.info to see what i'm getting in the loop.
1. the costs are 1288.72 and the total is and ttl is 1288.72
2. the costs are 1331.52 and the total is 1288.72 and ttl is 1331.521288.72
3. the costs are 0 and the total is 1331.52 and ttl is 01331.52
I've tried to convert the Cost and TTl Cost using parseInt() or number(), then the results are NaN.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-21-2025 07:35 AM
Can you try parseInt or parseFloat with mentioning base 10? It can be done. Like below if that works.
var a = '123';
var b = parseInt(a, 10);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-21-2025 09:08 AM
That work @Animesh Das2 . Thanks. I'm not sure why my other attempts at parseInt() returned NaN. But it's working now. as is parseFloat().toFixed(2).