Я не смог найти какие-либо встроенные функции в suiteCRM, которые бы это делали, потратил много времени на просмотр хром-отладчика, но ничего не помогло.
Вот видео, которое объясняет, что происходит, и фактическуюПример кода https://youtu.be/ebuwWZoSYCk
Вам необходимо получить новый статус из серверной части, а затем обновить поле внутри controller.php с помощью:
document.querySelector('div[type="enum"][field="$field_to_update"]').innerHTML = "$inventory_status_c";
Весь пример файла controller.phpздесь, все это имеет смысл, если вы смотрите 5-минутное видео:
class un_inventoryController extends SugarController {
/**
*
*/
function action_SubPanelViewer() {
require_once 'include/SubPanel/SubPanelViewer.php';
// only if this is creation of new sale under accounts, refresh the screen so the salerow subpanel will be refreshed too
if ( array_key_exists('module', $_REQUEST) && array_key_exists('subpanel', $_REQUEST) && array_key_exists('action', $_REQUEST) &&
$_REQUEST['module'] == 'un_inventory' && $_REQUEST['subpanel'] == "un_inventory_leads_1" && $_REQUEST['action'] == "SubPanelViewer") {
write_to_log(array("request" => $_REQUEST), "all conditions filled, custom controller called", true);
// Get the ID of the inventory unit so we can fetch the new status_c field and update the field right away (otherwise we'll have to refresh the page
$inventory = BeanFactory::getBean($_REQUEST["module"], $_REQUEST["record"]);
$inventory_status_c = ucwords(str_replace("_", " ", $inventory->status_c));
$field_to_update = "status_c";
$js=<<<EOQ
<script>
// Update the status
$( document ).ready(function() {
document.querySelector('div[type="enum"][field="$field_to_update"]').innerHTML = "$inventory_status_c";
});
</script>
EOQ;
echo $js;
}
}
}
?>