Before_save check in which view is calling save

Hi all,
i need to do some actions in before_save but only if the save method is called in particular view.

Just to be clear.
If view=‘EditView’ then do some logic and then save, if i am in a customEditview then do some other logic and then save.

Is it possible? or any other way to do it?

Many thanks


Every time you can analyse variable $_REQUEST .

I’ve tried, but i don’t see any info about caller view, please see below.
This is the print_r of $_REQUEST

  [module] => CDZ_Contracts_Mobile
    [record] => b6e4ecd5-5f77-edcf-7acb-5ff431d8e7ed
    [isDuplicate] => false
    [action] => Save
    [return_module] => CDZ_Contracts_Mobile
    [return_action] => DetailView
    [return_id] => 1fa12200-dd6e-0052-b650-5ff2e5b7d808
    [module_tab] => 
    [contact_role] => 
    [relate_to] => CDZ_Contracts_Mobile
    [relate_id] => 1fa12200-dd6e-0052-b650-5ff2e5b7d808
    [offset] => 2
    [assigned_user_name] => myuser
    [assigned_user_id] => 1f8a8a2d-d084-252b-116e-6018323b6f7d
    [assignment_info] => 

I see that it is standard save in EditView form because present: [module] => CDZ_Contracts_Mobile and [action] => Save.
If you want addition control you can add special field to EditView form.

Do you mean adding ex: a checkbox(flag) to intercept the action and based on that do different logic?
If checkbox is 1 then do otherwise do anything else?

Is there any way to override [action] => Save? This is a custom view taken form EditView…

Yes, it is a variant.

Yes, it’s possible but you should make custom button SAVE and/or SAVE AND CONTINUE.
I don’t recommend to do this because your logic_hook will not work. :wink:

1 Like