Workflow calculated field shows id instead of name

Hi, I am very new to SuiteCRM and trying to set it up for my company. My SuiteCRM is Version 7.11.8, Sugar Version 6.5.25 (Build 344). I have created a custom module called as ‘Asset’ to record the serial number of the machines we sell to the customer so there is a one to many relationship between Products and Asset as well as Accounts and Asset. Also I have a one to many relationship between Asset and Cases so that I can create a history of cases of machines we have sold based on the serial number. Now what I would like is that while the user is filling the Cases form and when he enters the Account and the Asset(Serial Number) and saves the form, the list view and the other views should have a field called as machine which is autopopulated with the product name. For this I have created a text field in Cases module called as ‘Machine’ and created a worflow to calculate the field machine using the relation parameter. The problem I am facing is that instead of showing the name of the product it is showing the ID. My observation is that if the field of the relation parameter is its own field then it shows the name but if it is a related field then it shows the ID. Is there a way some how I will be able to show the name of the product instead of the ID?

Hi @agupta,

I think the issues is on y our Workflow. Make sure you are assigning the right value to the field.

Other option is to add a related field via Studio and fill it with a logic hook. More info here: https://docs.suitecrm.com/developer/logic-hooks/

Thanks,

AlxGr

Hi AlxGr,

Thanks for the reply.

Please find below image of my workflow:

Also please find below the output of my workflow:

I thought I had some relationship messed up in my custom module so I made a test on using a standard module, please find below image of that workflow:

Please find the output of the workflow:

As you can see value is displayed only if the field belongs to the related parameter and ID is displayed if the field is a related field of the related parameter.

If I am making a mistake somewhere please point out.

Upon searching I found a solved issue https://github.com/salesagility/SuiteCRM/issues/3381, this sems similar, I maybe wrong. But the issue was while creating a new record using workflow and not while calculating a field.

I donot have a software background but if guided properly I can make changes in a code.

Thanks for the suggest for using logic hook. This will be a totally new field for me and will take time to update myself, hence would prefer I can do this using workflow.

I apologise in advance for any mistakes.

Thanks.

Hi,
I hope I understood your question correctly, therefore I shortly describe what I did and how my workflow looks like:

Data structure:

|-(1)-> Products
|          ^ (1)
|          |
|          |
|          v (n)
|        Asset <--(n)--(1)--> Accounts
|          ^ (1)
|          |
|          |
|          v (n)
|-(n)--> Cases

My test case:
My product (mainboard) has an asset called mainboard-asset-1.
The asset is related to an specific account (Cumberland)

Now, I try to create a new case and select the mentioned asset and the account. The product should be added automatically.

Workflow:

This should solve your issue as long as you use the serial number as the name for the asset.

If the serial number is not supposed to be the name of the asset, I guess workflows won’t be enough to solve this requirement. Instead, logic hooks could be used. It’s not that hard and we can support you doing it.

1 Like

Hi,
Thank you very much for taking time to explain me the process. My mistake was that the one to many relationship was missing between Products and Cases. This solved my problem.

Thanks also offering to support me for using logic hooks. If I need any other help I will post it on the forum.

Hi,
glad it’s working now :slight_smile: