Continuing the discussion from New button triggering workflow:
can’t hide and show record action button conditionally
Continuing the discussion from New button triggering workflow:
can’t hide and show record action button conditionally
<?php
namespace Symfony\Component\DependencyInjection\Loader\Configurator;
use Symfony\Component\DependencyInjection\ContainerBuilder;
return static function (ContainerBuilder $container): void {
$actions = $container->getParameter('module.recordview.actions') ?? [];
$modules = $actions['modules'] ?? [];
$leads = $modules['leads'] ?? [];
$recordActions = $leads['actions'] ?? [];
$recordActions['leads-assign'] = [
'key' => 'leads-assign',
"display" => "hide",
"asyncProcess" => true,
'labelKey' => 'LBL_ASSIGN',
'modes' => ['detail', 'edit'],
'params' => [
'displayConfirmation' => true,
'confirmationLabel' => 'LBL_ASSIGN_STATUS_CONFIRMATION',
'module' => 'leads',
],
'acl'=>["view"],
"aclModule" =>"Leads",
"displayLogic" => [
"leads_assign_visibility" => [
"modes" => [
0 => "detail",
1 => "edit",
2 => "create",
],
"params" => [
"activeOnFields" => [
"assign_flag_c" => [
'operator'=>'equal',
'value'=> 0,
],
],
],
],
]
];
$leads['actions'] = $recordActions;
$modules['leads'] = $leads;
$actions['modules'] = $modules;
$container->setParameter('module.recordview.actions', $actions);
};
this is my code but it is not working
I think you need to add a key (‘key’ => ‘displayType’) for your display logic and ‘assign_flag_c’ field is not there in leads bean. I have a working code where the button is not visible when fax is not 100. Please see if this helps you.
"displayLogic" => [
'key' => 'displayType',
"leads_assign_visibility" => [
"modes" => [
0 => "detail",
1 => "edit",
2 => "create",
],
"params" => [
"activeOnFields" => [
"phone_fax" => ["100"],
],
],
],
]