+ Start a Discussion
TheRealMarchandojTheRealMarchandoj 

Visual Flow is failing to run due to issue with Currency value captured

I have created a Visual workflow.
It is to calculate a summary total between 2 lookup objects.
It works most of the time but then sometimes it bombs out, due to the way Salesforce is handling the value stored in a currency field.

The flow looks up invoice records related to a Sales Order record.
It then stores the values in a collection.
The issue I'm having is that one of the invoices is returning it's net value as a figure with 36 decimal places: Net_Value__c=1499.999999999999999999999999999999999999
NOTE: On screen this invoice is displaying a value of 1,500 GBP (as are in this example the other 2 invoices)

Take a look at the collection values returned, below, all 3 invoices have been returned:
Coll_SalesOrderInvoices|[{Id=a0825000000OZOSAA4, Currency__c=GBP, Net_Value__c=1500.0, RecordTypeId=012b0000000PcxRAAS, CurrencyIsoCode=GBP}, {Id=a0825000000OZOXAA4, Currency__c=GBP, Net_Value__c=1500.0, RecordTypeId=012b0000000PcxRAAS, CurrencyIsoCode=GBP}, {Id=a0825000000Oa50AAC, Currency__c=GBP, Net_Value__c=1499.999999999999999999999999999999999999, RecordTypeId=012b0000000PcxRAAS, CurrencyIsoCode=GBP}]

As soon as the flow hits this value, it fails saying that the net_value__c amount was not set or assigned.

However, when the flow runs, it states that the net_value__c is not set or assigned for one of the invoices.. This is the record url: https://cs80.salesforce.com/a0825000000Oa50AAC

Take a look at the collection values returned, below, all 3 invoices have been returned:
Coll_SalesOrderInvoices|[{Id=a0825000000OZOSAA4, Currency__c=GBP, Net_Value__c=1500.0, RecordTypeId=012b0000000PcxRAAS, CurrencyIsoCode=GBP}, {Id=a0825000000OZOXAA4, Currency__c=GBP, Net_Value__c=1500.0, RecordTypeId=012b0000000PcxRAAS, CurrencyIsoCode=GBP}, {Id=a0825000000Oa50AAC, Currency__c=GBP, Net_Value__c=1499.999999999999999999999999999999999999, RecordTypeId=012b0000000PcxRAAS, CurrencyIsoCode=GBP}]

Has any one elese has experience of this kind of thing happening before? Is there anything I can do to resolve this issue?
Thanks inadvance

JaneUser-added image


DEBUG LOG SNIPPET:
12:14:08.796 (796486729)|FLOW_VALUE_ASSIGNMENT|7872e898dcb627a034d81fc05cd515124a02854-73da|Coll_SalesOrderInvoices|[{Id=a0825000000OZOSAA4, Currency__c=GBP, Net_Value__c=1500.0, RecordTypeId=012b0000000PcxRAAS, CurrencyIsoCode=GBP}, {Id=a0825000000OZOXAA4, Currency__c=GBP, Net_Value__c=1500.0, RecordTypeId=012b0000000PcxRAAS, CurrencyIsoCode=GBP}, {Id=a0825000000Oa50AAC, Currency__c=GBP, Net_Value__c=1499.999999999999999999999999999999999999, RecordTypeId=012b0000000PcxRAAS, CurrencyIsoCode=GBP}]
12:14:08.796 (796495141)|FLOW_VALUE_ASSIGNMENT|7872e898dcb627a034d81fc05cd515124a02854-73da|fLookup_Sales_Order_Invoices|true
12:14:08.796 (796510347)|FLOW_BULK_ELEMENT_DETAIL|FlowRecordLookup|fLookup_Sales_Order_Invoices|3
12:14:08.796 (796582078)|FLOW_ELEMENT_END|7872e898dcb627a034d81fc05cd515124a02854-73da|FlowRecordLookup|fLookup_Sales_Order_Invoices
12:14:08.796 (796609247)|FLOW_ELEMENT_BEGIN|7872e898dcb627a034d81fc05cd515124a02854-73da|FlowLoop|Loop_thru_Sales_Order_Invoices
12:14:08.796 (796748013)|FLOW_VALUE_ASSIGNMENT|7872e898dcb627a034d81fc05cd515124a02854-73da|Loopvar_SalesOrderInvoices|{Id=a0825000000OZOSAA4, Currency__c=GBP, Net_Value__c=1500.0, RecordTypeId=012b0000000PcxRAAS, CurrencyIsoCode=GBP}
12:14:08.796 (796754086)|FLOW_VALUE_ASSIGNMENT|7872e898dcb627a034d81fc05cd515124a02854-73da|Loop_thru_Sales_Order_Invoices.currentIteration|0
12:14:08.796 (796769067)|FLOW_LOOP_DETAIL|7872e898dcb627a034d81fc05cd515124a02854-73da|0|a0825000000OZOSAA4
12:14:08.796 (796796234)|FLOW_ELEMENT_END|7872e898dcb627a034d81fc05cd515124a02854-73da|FlowLoop|Loop_thru_Sales_Order_Invoices
12:14:08.796 (796829996)|FLOW_ELEMENT_BEGIN|7872e898dcb627a034d81fc05cd515124a02854-73da|FlowAssignment|Assign_Net_Amount_to_total_Net_Amount_for_Sales_Order_Invoices
12:14:08.797 (797227031)|FLOW_ASSIGNMENT_DETAIL|7872e898dcb627a034d81fc05cd515124a02854-73da|var_TotalNetAmount|ADD|1,500
12:14:08.797 (797349272)|FLOW_ASSIGNMENT_DETAIL|7872e898dcb627a034d81fc05cd515124a02854-73da|var_Currency|ASSIGN|GBP
12:14:08.797 (797357953)|FLOW_VALUE_ASSIGNMENT|7872e898dcb627a034d81fc05cd515124a02854-73da|var_Currency|GBP
12:14:08.797 (797366047)|FLOW_VALUE_ASSIGNMENT|7872e898dcb627a034d81fc05cd515124a02854-73da|var_TotalNetAmount|EUR 1500.0
12:14:08.797 (797390537)|FLOW_ELEMENT_END|7872e898dcb627a034d81fc05cd515124a02854-73da|FlowAssignment|Assign_Net_Amount_to_total_Net_Amount_for_Sales_Order_Invoices
12:14:08.797 (797410102)|FLOW_ELEMENT_BEGIN|7872e898dcb627a034d81fc05cd515124a02854-73da|FlowLoop|Loop_thru_Sales_Order_Invoices
12:14:08.797 (797523502)|FLOW_VALUE_ASSIGNMENT|7872e898dcb627a034d81fc05cd515124a02854-73da|Loopvar_SalesOrderInvoices|{Id=a0825000000OZOXAA4, Currency__c=GBP, Net_Value__c=1500.0, RecordTypeId=012b0000000PcxRAAS, CurrencyIsoCode=GBP}
12:14:08.797 (797532483)|FLOW_VALUE_ASSIGNMENT|7872e898dcb627a034d81fc05cd515124a02854-73da|Loop_thru_Sales_Order_Invoices.currentIteration|1
12:14:08.797 (797555884)|FLOW_LOOP_DETAIL|7872e898dcb627a034d81fc05cd515124a02854-73da|1|a0825000000OZOXAA4
12:14:08.797 (797587569)|FLOW_ELEMENT_END|7872e898dcb627a034d81fc05cd515124a02854-73da|FlowLoop|Loop_thru_Sales_Order_Invoices
12:14:08.797 (797616962)|FLOW_ELEMENT_BEGIN|7872e898dcb627a034d81fc05cd515124a02854-73da|FlowAssignment|Assign_Net_Amount_to_total_Net_Amount_for_Sales_Order_Invoices
12:14:08.797 (797768688)|FLOW_ASSIGNMENT_DETAIL|7872e898dcb627a034d81fc05cd515124a02854-73da|var_TotalNetAmount|ADD|1,500
12:14:08.797 (797875180)|FLOW_ASSIGNMENT_DETAIL|7872e898dcb627a034d81fc05cd515124a02854-73da|var_Currency|ASSIGN|GBP
12:14:08.797 (797882621)|FLOW_VALUE_ASSIGNMENT|7872e898dcb627a034d81fc05cd515124a02854-73da|var_Currency|GBP
12:14:08.797 (797888579)|FLOW_VALUE_ASSIGNMENT|7872e898dcb627a034d81fc05cd515124a02854-73da|var_TotalNetAmount|EUR 3000.0
12:14:08.797 (797909624)|FLOW_ELEMENT_END|7872e898dcb627a034d81fc05cd515124a02854-73da|FlowAssignment|Assign_Net_Amount_to_total_Net_Amount_for_Sales_Order_Invoices
12:14:08.797 (797927682)|FLOW_ELEMENT_BEGIN|7872e898dcb627a034d81fc05cd515124a02854-73da|FlowLoop|Loop_thru_Sales_Order_Invoices
12:14:08.798 (798029057)|FLOW_VALUE_ASSIGNMENT|7872e898dcb627a034d81fc05cd515124a02854-73da|Loopvar_SalesOrderInvoices|{Id=a0825000000Oa50AAC, Currency__c=GBP, Net_Value__c=1499.999999999999999999999999999999999999, RecordTypeId=012b0000000PcxRAAS, CurrencyIsoCode=GBP}
12:14:08.798 (798046655)|FLOW_VALUE_ASSIGNMENT|7872e898dcb627a034d81fc05cd515124a02854-73da|Loop_thru_Sales_Order_Invoices.currentIteration|2
12:14:08.798 (798066012)|FLOW_LOOP_DETAIL|7872e898dcb627a034d81fc05cd515124a02854-73da|2|a0825000000Oa50AAC
12:14:08.798 (798098896)|FLOW_ELEMENT_END|7872e898dcb627a034d81fc05cd515124a02854-73da|FlowLoop|Loop_thru_Sales_Order_Invoices
12:14:08.798 (798130746)|FLOW_ELEMENT_BEGIN|7872e898dcb627a034d81fc05cd515124a02854-73da|FlowAssignment|Assign_Net_Amount_to_total_Net_Amount_for_Sales_Order_Invoices
12:14:08.798 (798942074)|FLOW_ELEMENT_END|7872e898dcb627a034d81fc05cd515124a02854-73da|FlowAssignment|Assign_Net_Amount_to_total_Net_Amount_for_Sales_Order_Invoices
12:14:08.830 (830765192)|FLOW_ELEMENT_ERROR|The flow failed to access the value for Loopvar_SalesOrderInvoices.Net_Value__c because it hasn't been set or assigned.||
12:14:08.830 (830793063)|FLOW_START_INTERVIEW_END|7872e898dcb627a034d81fc05cd515124a02854-73da|Calc Invoiced To Date - part 1

 
Andy BoettcherAndy Boettcher
This one definitely looks like a potential bug - open a case with Support to get this documented and have them walk through your Flow with you.
CillaCilla
I'm getting the same thing. Was your issue resolved?
debradebra
I'm having the same issue and have logged a ticket to see if an issue can be created.  This seems to be similar issue as bug related to percent fields which behave somewhat like currency fields.   I'll report back if I get anything from tech support.
This issue does not seem to occur with standard curency fields like unitprice or formula currency field.
CillaCilla
Yes, I eventually had to create a case with Salesforce. It was a bug on their end. Priscilla Pestoff | IS Analyst | Ochsner Health System | Tel: (504)842-5239
debradebra
Do you have the bug# or link.   It helps to "vote" on the issue so they know how many people are affected and might actually fix it. Curious what workaround did you use if any?
CillaCilla
It was a case with Salesforce Support. We found a work-around by running the below code. This was run in developer console just to get my flow working. My understanding was they were supposed to still address the underlying issue on their side. This code basically retrieves the currency field, then in the loop converts it to a string and if length is greater than 12, then scale it to 12, and update it. This was our workaround code: list conToUpdate = [SELECT CY_ALL_LINES__c FROM Contact where CY_ALL_LINES__c != NULL AND CY_ALL_LINES__c > 0]; list resultList = new list {}; for (Contact con: conToUpdate) { decStr = String.valueOf(con. CY_ALL_LINES__c); If (decstr.length() >13) { x = con. CY_ALL_LINES__c; con. CY_ALL_LINES__c = x.setScale(12); resultList.add(con); } } Priscilla Pestoff | IS Analyst | Ochsner Health System | Tel: (504)842-5239
debradebra
Priscilla - thanks for the tip.  Just wondering did the Flow continue to work after it was activated in cases where new data was created that was over 13 digits?
CillaCilla
This was one of our “end of year” flows. So, I don’t know yet! We shall see. I’m hoping SF has resolved the bug on their side! Otherwise, I’ll have to use this workaround again. Priscilla Pestoff | IS Analyst | Ochsner Health System | Tel: (504)842-5239