- 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-17-2025 10:50 AM - edited 01-17-2025 10:51 AM
Hi @EricG ,
The error looks like the 'cost' is not reference from the step 'look up record' action is step number 8 of your flow.
Can you modify the line as below if that error gets fixed.
var origCst = fd_data._8__look_up_hardware_record.record.cost;
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-17-2025 12:08 PM
@Animesh Das2 well I've looked at Steps 6, 7 and 8.
In #6 i'm parsing out a List Collector to get the SYS_ID's of the alm_hardware selected.
Then in Step 7, doing a For loop for each value from #6
Step 8 looks up the alm_hardware record from #7, which the table has cost as a table column.
Here is the original flow with just using the Pill + Pill. As you can see, I am getting the Cost Value of that record.
So, the variable on the RITM shows "+0+952.03+0"
First value had no cost (0), Secon had 952.03, while last had 0.
Should i be putting this as a String or Variable?
I'm not getting why the Pill + Pill will return a value, while the Script isn't.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-17-2025 12:20 PM - edited 01-17-2025 12:32 PM
@EricG , can you share the screenshots of the steps where you are facing the issue with script approach, and along with pill + pill stuff which is working?
However, for concatenation you always need to convert a variable into string before. Like you can convert the line that I shared in my previous reply into string as,
var origCst = fd_data._8__look_up_hardware_record.record.cost.toString();
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 05:23 AM
OK, let me restate, that the Cost Flow Variables are not returning the desired results.
I do not need these to be concatenated, but summed.
Here is a shot of where I'm updating the Selected alm_hardware from the cat_item
I am getting the sys_id of the asset, so then I look that record up
so after updating the asset to "Deployed", I'm setting my flow variables
My thinking it is to set Cost and Total Cost with the assets model cost for Loop pass 1
Then, with loop pass 2+, replace cost with asset2 cost and update TTL with existing + new value of asset 2+.
The screen shot above gives me the concatenated costs $1+$2+etc..., which is not wanted.
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);
This script is what is giving me the ref error.