Show Data From Custom Field In Different Module

I’m looking for some advice - I believe that I will need to use logic hooks to accomplish what I want, but I can’t seem to find a guide as to how to actually accomplish it or get it to work!

What I want to do is be able to show data from a custom field in Accounts module in the Cases module, at the point that a case is being created & is assigned to an account (preferably before the case is initially saved).

So lets say there is a field in Accounts called SLA. This is a text field & the data is saved against each account in the database.

Then when an account is selected in Case, I want the data from the Accounts SLA field to be shown in the Cases module - not to be edited, simply for information.

How do I accomplish this?? :blink:

I’ve posted a sample code over here for a similar requirement

Amariussi raised some valid points regarding such requirements at

Read both the posts and make sure how you need to proceed.

Thanks for the additional reading - I hadn’t actually come across them during the searching so that was another method to try!

However…I feel I am doing something really simple wrong, as I still cannot get it to work.

This is the code I came up with after reading your post:

    class before_save_class
        function before_save_method($bean, $event, $arguments)

           $account = new Account(); // So this links $account to the Accounts module?
           $account->retrieve($bean->lbl_account_name); // This is the label of the field in Accounts that has the account name - which is what we search for in Cases when creating a new case, so once this account is selected, the below should be filled in?

           // $bean is your current record being saved. 
           // $account is the related account.
           $bean->support_level_c = $account->support_level_c; // These are the field in Accounts that I want to be shown in Cases once the Account has been selected (before saving the case)


But I still cannot get it to show! How do I relate support_level_c in the Cases module to Support_Level_C in Accounts? Do I create a text field in Cases? Or a relate field? Nothing I seem to do actually causes it to be automatically filled in from the Accounts module!


Since we are dealing with cases, the field which contains account’s ID is account_id
So you retrieval would be something like


In this case if you update the support level in accounts, it will be not be updated in previously created cases automatically, unless you edit/save the case again.
Just to add a few more points,
If you update support level in accounts and then edit/save a previous case, its support level will also be updated. This is called as infinite loops in logic hooks.
Thers a guide here to avoid such loops

And lastly, yes you will need a text field “support_level_c” in cases to hold the value from accounts.

1 Like

Arsalan thank you! That was the last piece of the puzzle!! :slight_smile: