diff --git a/ProcessMaker/Repositories/TokenRepository.php b/ProcessMaker/Repositories/TokenRepository.php index ac00c94301..749b3ff54c 100644 --- a/ProcessMaker/Repositories/TokenRepository.php +++ b/ProcessMaker/Repositories/TokenRepository.php @@ -7,6 +7,8 @@ use Illuminate\Support\Facades\Log; use Mustache_Engine; use ProcessMaker\Mail\TaskActionByEmail; +use ProcessMaker\Managers\DataManager; +use ProcessMaker\Models\FeelExpressionEvaluator; use ProcessMaker\Models\ProcessAbeRequestToken; use ProcessMaker\Models\ProcessCollaboration; use ProcessMaker\Models\ProcessRequest as Instance; @@ -128,8 +130,11 @@ public function persistActivityActivated(ActivityInterface $activity, TokenInter $token->self_service_groups = ['users' => $evaluatedUsers, 'groups' => $evaluatedGroups]; break; case 'process_variable': - $evaluatedUsers = $selfServiceUsers ? $token->getInstance()->getDataStore()->getData($selfServiceUsers) : []; - $evaluatedGroups = $selfServiceGroups ? $token->getInstance()->getDataStore()->getData($selfServiceGroups) : []; + $dataManager = new DataManager(); + $tokenData = $dataManager->getData($token); + $feel = new FeelExpressionEvaluator(); + $evaluatedUsers = $selfServiceUsers ? $feel->render($selfServiceUsers, $tokenData) ?? null: []; + $evaluatedGroups = $selfServiceGroups ? $feel->render($selfServiceGroups, $tokenData) ?? null : []; // If we have single values we put it inside an array $evaluatedUsers = is_array($evaluatedUsers) ? $evaluatedUsers : [$evaluatedUsers];