I was trying to add a button from the actions dropdown in detail view. The button when clicked should change the account status field.
Here is the code I have added in suitecrm/custom/modules/Accounts/metadata/detailviewdefs.php but this is not changing the status field value. The Account page looks refreshed as it is going to the Home page and coming back to the same account page after clicking on the Button.
array (
'customCode' => '<form><input type = "hidden" name ="isSaveAndNew" value = "false">
<input type = "hidden" name ="status_c" value = "">
<input type = "hidden" name ="isSaveFromDetailView" value = "true">
<input title="Move to Next Status" class="button"
onClick="this.form.status_c.value=\'Pilot\';
this.form.action.value=\'Save\';
this.form.return_module.value=\'Accounts\';
this.form.return_action.value=\'DetailView\';
this.form.return_id.value=\'{$fields.id.value}\';
this.form.module.value=\'Accounts\';"
name="move_to_next_status"
value="Move to Next Status"
type="submit"></form>',
)
Where is your Code? Please share that
rsp
1 October 2024 13:47
5
Are you using v7.x or v8.x?
Displaying a Custom View from SuiteCRM 7 in SuiteCRM 8
I wanted to share how to display a custom view from SuiteCRM 7 in the SuiteCRM 8 system. I referenced an article (and video) - SuiteCRM Developer Insights - Module Record Actions - SuiteCRM along with the code for ‘convertlead’ action from the legacy ‘Leads’ module to guide me through the process. Below are the steps I followed to successfully display a custom view:
The first step is to copy the detailviewdefs.php file from the modules/Ac…
1 Like
i am using v8.6 i am trying this way but i don’t know what is the problem
<?php
namespace App\Extension\defaultExt\modules\Leads\Services;
use ApiPlatform\Core\Exception\InvalidArgumentException;
use App\Module\Service\ModuleNameMapperInterface;
use App\Process\Entity\Process;
use App\Process\Service\ProcessHandlerInterface;
class AssignLeadAction implements ProcessHandlerInterface
{
protected const MSG_OPTIONS_NOT_FOUND = 'Process options are not defined';
protected const PROCESS_TYPE = 'record-assign-lead';
/**
* @var ModuleNameMapperInterface
*/
private $moduleNameMapper;
/**
* MergeRecordsBulkAction constructor.
* @param ModuleNameMapperInterface $moduleNameMapper
*/
public function __construct(ModuleNameMapperInterface $moduleNameMapper)
{
$this->moduleNameMapper = $moduleNameMapper;
}
/**
* @inheritDoc
*/
public function getProcessType(): string
{
return self::PROCESS_TYPE;
}
/**
* @inheritDoc
*/
public function requiredAuthRole(): string
{
return 'ROLE_USER';
}
/**
* @inheritDoc
*/
public function getRequiredACLs(Process $process): array
{
$options = $process->getOptions();
$module = $options['module'] ?? '';
$id = $options['id'] ?? '';
return [
$module => [
[
'action' => 'view',
'record' => $id
],
],
];
}
/**
* @inheritDoc
*/
public function configure(Process $process): void
{
//This process is synchronous
//We aren't going to store a record on db
//thus we will use process type as the id
$process->setId(self::PROCESS_TYPE);
$process->setAsync(false);
}
/**
* @inheritDoc
*/
public function validate(Process $process): void
{
}
/**
* @inheritDoc
*/
public function run(Process $process)
{
$options = $process->getOptions();
$leadid=$options['record']['attributes']['id'];
$leadbean=BeanFactory::getBean('Leads',$leadid);
$leadbean->status="Assigned";
$responseData = [
'handler' => 'redirect',
'params' => [
'route' => $options['module'] . '/convert-lead/' . $options['id'],
'queryParams' => [
]
]
];
$process->setStatus('success');
$process->setMessages([]);
$process->setData($responseData);
}
}
this is my code
rsp
1 October 2024 13:54
8
I think @Harshad could help you with it.
Make sure you have correct permissions and ownership to these files.
rsp
1 October 2024 16:04
9
Answered in your another post:
I tried to implement the functionality on my machine. I could get it successfully working. The following are the code changes:
public\legacy\custom\Extension\application\Ext\Language\en_us.lang.php
<?php
$app_strings['LBL_ASSIGN_STATUS_CONFIRMATION']='Are you sure to change the status of this lead?';
extensions\defaultExt\config\modules\Leads\recordview\actions\assign_lead.php
<?php
namespace Symfony\Component\DependencyInjection\Loader\Configurator;
use Symfony\Component\DependencyInjec…