"PEN" edit icon does not behave as the regular edit Button ?

Building a trigger so when a user modify an account it automatically creates a related case for the account.
Obviously there are more logic/conditions involved but I removed them for the sake of finding where my problem resides and
I found that if you edit the account using the pen icon, the created case is not related to the account…

So here is my simplified function :

   
function CheckAccountTypes(&$bean, $event, $arguments) {
        global $current_user;
        global $db;

        try {
            $newCase = BeanFactory::newBean('Cases');
            $newCase->state = 'Open';
            $newCase->status = 'Open_New';
            $newCase->type = 'Administration';
            $newCase->name = 'test pour Serge '. date('H:i:s', time());
            $newCase->description ='this is a test' ;
            $newCase->save();
        }
        catch (Exception $e){
            $GLOBALS['log']->fatal("log " .__FUNCTION__." $e ".__LINE__);
        }
    }

My problem is not with the hook, because it triggers all right, when saving the account, I create a new case.
BUT
[ul]
[li]When I begin the process with the Edit button the created case is related to the account.
[/li]- When I begin the process with the Pen icon from the left last viewed list, the newly created case is NOT related to the account.

(post edit) I tested creating a new account and the case is NOT related to the account…

Is it me that does not understand how it works or is this a bug that I need to report?

Thank you

Why are just not using the WorkFlow module?

What type of hook are you using? if is an after_save, there’s no logical explanation why this is happening to you, the pencil or edit button do the same thing, edit that entry and then you call the save method

best regards

it is after_save…

I already looked at workflow and using it when I can…
I would need to build many workflow to dispatch the created case to the right person, depending on country the case could be assigned to 5 different persons…
so I am afraid of performance issue having so much workflow vs a simple file…
and my most important problem with workflow is the related drop down support…

Background info: our ERP drops / update informations in CRM and create accounts when needed, special fields are also used…

After a CRM user save the account, I need to compare 2 fields that the ERP drops in the accounts and compare it to 2 dropdown one being related…
like ERP customer type = ‘Private’ then CRM drop down is ‘Private’
and ERP customer subtype ‘Student’ then CRM drop down is ‘Private_Student’…
the hook watch if the ERP fields no longer match the CRM fields after save (a user changed either drop down values) then a case is triggered to ask CSR’s people to modify or update the ERP record… since my salesperson in the fields does not have access to ERP and CSR’s does…

I would be really surprised if this is achievable via workflow… but “easily” controlled via php if the pen icon would behave correctly…

I believe more operators in the workflow module might handy like “is not null”, strlen >, etc…

I am open to ideas…
… and if this is really a bug then it is dangerous for unwanted behavior…

yes, logical operators are very much needed in the WorkFlow module, let me test this in my environment, is really weird the thing about the pencil and the edit button, is not logical but who knows… can you post your system settings so I can match it?

are you populating SuiteCRM via web service with your ERP? just to clarify, logic_hooks only triggers if is done via the application it self (browsing it) or via web service, not via sql commands or something like that.

best regards

suitecrm 7.5.3 will try to update over the week end…
php 5.6.22 IIs running on my dev machine windows 10
sql server 2012

the erp is updating sql directly via our own querieis, when we implemented this 5 years ago I was not at ease with soap…

thank you Mike for trying to make sense of this…

hello Mike,

oups, not running 7.5.3 but 7.6.5 !

do you need other information about my setup?