AnsweredAssumed Answered

"Exception evaluating expression in SetValueAction" error in Sugarlog

Question asked by Kristjan Mathiesen on Sep 13, 2017
Latest reply on Sep 15, 2017 by Kristjan Mathiesen

Hi all.

 

Ok, I have this field called "Half Way Through"  that calculates number of dates from when the Opportunity is created and until "Expected Close Date" is, divides that by 2 and then adds those number of days to today´s date (idea being that half way from today until "Expected Close Date" we should be about halfway through the sales stages). Here is the field:

 

 

Additionally, we have a workflow that sends out an email reminder at that "Half Way Through" point:

The evaluation is to see if the sale stage is past 50% (then no email, else send email reminder). It seems to work fine and the emails seem to be sending out, however, we get this error in the Sugarlog (and you can see the formula behind the calculated value of this field):

Tue Sep 12 13:04:02 2017 [25861][1][FATAL] Exception evaluating expression in SetValueAction, addDays(today(),divide(abs(subtract(daysUntil($date_closed),daysUntil(today()))),2)) : value ' ' must be numeric

#0 /var/www/sugarcrmprod/include/SugarMath/SugarMath.php(125): SugarMath->testValue(false)
#1 /var/www/sugarcrmprod/include/SugarMath/SugarMath.php(65): SugarMath->setValue(false)
#2 /var/www/sugarcrmprod/include/SugarMath/SugarMath.php(91): SugarMath->__construct(false, 6)
#3 /var/www/sugarcrmprod/include/Expressions/Expression/Numeric/SubtractExpression.php(30): SugarMath::init(false, 6)
#4 /var/www/sugarcrmprod/include/Expressions/Expression/Numeric/AbsoluteValueExpression.php(24): SubtractExpression->evaluate()
#5 /var/www/sugarcrmprod/include/Expressions/Expression/Numeric/DivideExpression.php(29): AbsoluteValueExpression->evaluate()
#6 /var/www/sugarcrmprod/include/Expressions/Expression/Date/AddDaysExpression.php(30): DivideExpression->evaluate()
#7 /var/www/sugarcrmprod/include/Expressions/Actions/SetValueAction.php(124): AddDaysExpression->evaluate()
#8 /var/www/sugarcrmprod/include/Expressions/Dependency.php(199): SetValueAction->fire(Object(Opportunity))
#9 /var/www/sugarcrmprod/include/Expressions/Dependency.php(175): Dependency->fireActions(Object(Opportunity))
#10 /var/www/sugarcrmprod/data/SugarBean.php(1969): Dependency->fire(Object(Opportunity))
#11 /var/www/sugarcrmprod/modules/Opportunities/SaveOverload.php(35): SugarBean->updateCalculatedFields()
#12 /var/www/sugarcrmprod/modules/Opportunities/Opportunity.php(441): perform_save(Object(Opportunity))
#13 /var/www/sugarcrmprod/modules/pmse_Inbox/engine/PMSEEngineUtils.php(1439): Opportunity->save()
#14 /var/www/sugarcrmprod/modules/pmse_Inbox/engine/PMSEElements/PMSEChangeField.php(206): PMSEEngineUtils::saveAssociatedBean(Object(Opportunity))
#15 /var/www/sugarcrmprod/modules/pmse_Inbox/engine/PMSEExecuter.php(514): PMSEChangeField->run(Array, Object(Opportunity), '', Array)
#16 /var/www/sugarcrmprod/modules/pmse_Inbox/engine/PMSEExecuter.php(390): PMSEExecuter->processElement(Array, Object(Opportunity), '', Array)
#17 /var/www/sugarcrmprod/modules/pmse_Inbox/engine/PMSEExecuter.php(451): PMSEExecuter->runEngine(Array, false, Object(Opportunity))
#18 /var/www/sugarcrmprod/modules/pmse_Inbox/engine/PMSEExecuter.php(451): PMSEExecuter->runEngine(Array, false, Object(Opportunity))
#19 /var/www/sugarcrmprod/modules/pmse_Inbox/engine/PMSEExecuter.php(451): PMSEExecuter->runEngine(Array, false, Object(Opportunity))
#20 /var/www/sugarcrmprod/modules/pmse_Inbox/engine/PMSEExecuter.php(451): PMSEExecuter->runEngine(Array, false, Object(Opportunity))
#21 /var/www/sugarcrmprod/modules/pmse_Inbox/engine/PMSEHandlers/PMSEHookHandler.php(162): PMSEExecuter->runEngine(Array, false, NULL, 'WAKE_UP')
#22 /var/www/sugarcrmprod/modules/pmse_Inbox/engine/PMSEHandlers/PMSEHookHandler.php(150): PMSEHookHandler->newFollowFlow(Array, false, NULL, 'WAKE_UP')
#23 /var/www/sugarcrmprod/modules/pmse_Inbox/engine/PMSEHandlers/PMSEHookHandler.php(125): PMSEHookHandler->wakeUpSleepingFlows()
#24 /var/www/sugarcrmprod/custom/application/Ext/ScheduledTasks/scheduledtasks.ext.php(34): PMSEHookHandler->executeCron()
#25 [internal function]: PMSEEngineCron(Object(SchedulersJob))
#26 /var/www/sugarcrmprod/modules/SchedulersJobs/SchedulersJob.php(515): call_user_func_array('PMSEEngineCron', Array)
#27 /var/www/sugarcrmprod/include/SugarQueue/SugarCronJobs.php(195): SchedulersJob->runJob()
#28 /var/www/sugarcrmprod/include/SugarQueue/SugarCronJobs.php(240): SugarCronJobs->executeJob(Object(SchedulersJob))
#29 /var/www/sugarcrmprod/cron.php(43): SugarCronJobs->runCycle()
#30 {main}

Here is a picture as well:

So what value must be numeric?

The Formula Builder (when editing the field) does not complain when I save the formula. Any ideas what is causing?

 

Thanks,

KGM

Outcomes