I’m creating a custom action where i want to update $PlannedAmount with the following calculation: $BudgetedHours * 40
The error I’m getting is “Error: Formula evaluation result data type is Duration instead of expected Currency”
I’ve tried a few different options but am missing the correct way to put together this request.
Thanks all
Page 1 / 1
Hi @mpjubb
In AdaptiveWork, you can't multiply a Duration directly by a number to get a Currency result. You must first convert the Duration to a numeric value using:
This conversion should resolve the data type mismatch.
Thanks Archana D,
I’m getting an error that DurationToHours() and DurationToDecimal() are not valid functions:
Error: Function DurationToHours() not found
It looks like the function names I shared earlier aren’t supported in your environment. Let me help you find the right approach for your Duration to Currency conversion.
The core issue is that AdaptiveWork needs to convert your $BudgetedHours (Duration) into a numeric value before multiplying by 40 to get a Currency result.
Try these solutions in order:
Option 1 - Division method (most reliable):
$PlannedAmount = ($BudgetedHours / 1h) * 40
This divides your duration by 1 hour to get a numeric ratio, then multiplies by 40.
Option 2 - Direct property access:
$PlannedAmount = $BudgetedHours.Hours * 40
Option 3 - Common conversion functions:
$PlannedAmount = ToHours($BudgetedHours) * 40
If these don't resolve the error, the best next step would be to create a support ticket so our technical team can review your exact setup and confirm the correct syntax for your environment.