Help creating a read only field to read from related module

Hello All,

We are kind of new to Suitecrm,

We have a module called Shipments which is related to Accounts (Accounts is parent)

We are trying to have a field in Shipments detailed view that will populate the “Office phone number” from the related account.

BTW we are using Version 7.11.10

Any help is highly appreciated.

welcome to the suite-community!

You could do it with a workflow (using the Suite-UI) or with a hook (php/code-level). Both options should cover your use case easily.

Thank you so much for the quick reply, we have tried using workflows to obtain that, but no luck, should we use calculate fields option? if so what is the formula? thanks again.

I can provide you an example later :slight_smile:

Thank you much :grinning:

I’ve created a similar example with accounts and cases.

  • if a new case is being saved (“only on save”/“new records”)
  • and the description is null (you usually don’t want to override the field in case someone enters a proper value while creating the object)

  • then copy from the parent account a field (in this case: the description)
  • and set it as value for the cases’ description

Hello Diligent,

Thank you for the help, your example is very logic, however, I tried it and it is not showing anything, I can see in the Audit list that some records was done, but it just does now show anything in Phone field.
Perhaps something is wrong in the system? thanks.

Mhm…maybe I have to create a fresh copy of Suite to build your exact use case. Will post an update in case I’m successful.

1 Like

So I did install the latest 7.11. on localhost, created a shipment module plus the account-relation and copied the workflow as shown above:

-> Works. I’m currently thinking about what could be wrong with your installation, but don’t have any ideas yet. :frowning:

Regarding your shipment<->account relation: is it 1:n or n:m?

Dilligent, thank you so much for the help, you are great.

I am thinking something is wrong with our installation, since we were able to get the workflow to work on a different field, however, right after the field is imported it deletes the relationship of the shipment to the account.

I think we better of just reinstalling everything from scratch to avoid issues.

We are thinking of going with the SuiteCRM 7.10.22 instead of 7.11.10.

As far as the relationship we have it is a one-to-many, is this OK? thanks again.

yes, one-to-many is fine (I was just asking in case there are multiple accounts related to the shipment-object).

good luck with your new installation, hope it works better afterwards!