Menu
SuiteCRM dedicated support by SalesAgility
Welcome, Guest
Username: Password: Remember me

TOPIC: required fields

required fields 4 months 2 days ago #69188

  • JorgeT
  • JorgeT's Avatar
  • Offline
  • New Member
  • Posts: 4
  • Karma: 0
sugar 6.5
Hello there, I'm currently working on cases module, on this module I have a field status with the value (Open, Closed) and on the second subpanel called resolution I have a resolution field, what I try to do is when I get status = Closed make the resolution required, I try logic hook but I can set the field to require, It's any way to set the $dictionary on the logic hook? or is there any better way?
The administrator has disabled public write access.

required fields 4 months 2 days ago #69190

  • pgr
  • pgr's Avatar
  • Offline
  • Administrator
  • Posts: 8202
  • Thank you received: 1263
  • Karma: 296
Hi! These Forums are for SuiteCRM, not SugarCRM...

My SuiteCRM In-depth blog.
Thank you for always stating your SuiteCRM version, checking your logs, reading the Docs, and searching before you ask!
The administrator has disabled public write access.

required fields 4 months 2 days ago #69192

  • JorgeT
  • JorgeT's Avatar
  • Offline
  • New Member
  • Posts: 4
  • Karma: 0
Thanks for your replay, any advice for suiteCRM 7.8?
The administrator has disabled public write access.

required fields 4 months 2 days ago #69194

  • pgr
  • pgr's Avatar
  • Offline
  • Administrator
  • Posts: 8202
  • Thank you received: 1263
  • Karma: 296
It's hard to help with code issues unless you post the full code (inside the Forum's "code" tags, please).

Is your Hook running, can you confirm this?

My SuiteCRM In-depth blog.
Thank you for always stating your SuiteCRM version, checking your logs, reading the Docs, and searching before you ask!
The administrator has disabled public write access.

required fields 4 months 2 days ago #69197

  • JorgeT
  • JorgeT's Avatar
  • Offline
  • New Member
  • Posts: 4
  • Karma: 0
absolutely, the logic hook is running I also get the value of the field and do a modification to the resolution field but I do not stop me to put some data in the field here is the code:

logic hook:
$hook_array['before_save'] = Array();
$hook_array['before_save'][] = Array(15, 'resolution required', 'custom/modules/Cases/resolution.php', 'resolution','resolution_required');   

resolution.php
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');

class resolution{
     
    function resolution_required ($bean, $event, $arguments){
       
        
        $GLOBALS['log']->debug('bean-> '. $bean->state);
        //$GLOBALS['log']->debug('bean1-> '. print_r($bean->field_name_map['state'], true));
        if($bean->state == 'Closed'){
           $bean->field_name_map['resolution'] += array('required' => 1);
           $GLOBALS['log']->debug('show--> ' . print_r($bean->field_name_map['resolution'], true));
           //include('custom/Extension/modules/Cases/Ext/Vardefs/resolution_required.php');
           $GLOBALS['log']->debug('inside_statement');

        }
       

        
    }
}                       
The administrator has disabled public write access.

required fields 4 months 2 days ago #69204

  • pgr
  • pgr's Avatar
  • Offline
  • Administrator
  • Posts: 8202
  • Thank you received: 1263
  • Karma: 296
I now understand better what you're trying to do.

I believe you have to change your approach. You can't make it required in the vardefs, or in the dictionary, since those things take effect on screens, and the logic hook is not running on a screen.

Normally this kind of thing is done by overriding the display class of the view you want to change. And there you can inject some javascript to react to changes and give some user feedback to make the field required.

Google for stuff related to overriding views, validating fields, etc.

Maybe this one will be helpful
suitecrm.com/suitecrm/forum/developer-he...-viewedit-validation

My SuiteCRM In-depth blog.
Thank you for always stating your SuiteCRM version, checking your logs, reading the Docs, and searching before you ask!
Last Edit: 4 months 2 days ago by pgr.
The administrator has disabled public write access.

required fields 4 months 2 days ago #69206

  • JorgeT
  • JorgeT's Avatar
  • Offline
  • New Member
  • Posts: 4
  • Karma: 0
Thank you, I will
The administrator has disabled public write access.
Time to create page: 0.067 seconds
Powered by Kunena Forum