Concatenate fields to set reference display value

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-22-2018 10:47 AM
I've been wondering if there is a good way to concatenate two fields on a reference table to change the way that a reference is displayed.
As an example, I am working on some changes in our Finance application and we have accounts that are being renamed and the account codes are changing. Our staff are used to seeing things shown a certain way in other documents, where the account codes/names are written out like "160 - Technology", but this seems redundant in SN to have the name include the code that is already in the code field, since the name of the account would be "Technology" and the code is "160". However for ease of use/recognition I'd like to see if there is a way to have those two field concatenated together to create the string that people are used to seeing, and have that be the display value in the box when placed on forms.
I believe that I could do this by creating a 3rd field to hold the value and make that the Display field for the Account table, but wonder how that would effect other things like uploads? Monthly the Finance team uploads Excel sheets that hold changes to budgets/accounts, and I'd like to simplify the uploads as well, since they generally only like to use the account code (e.g. 160) and not the name or the concatenated version. Is it possible to have the best of all worlds and display the concatenated value for end users, but reference only the code when we go to upload on the Finance table?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-22-2018 10:55 AM
We do something similar with our asset table, we have a "Display Name" field that we concatenate the asset name and the serial number.
To do this:
- Make a string field on your form.
- Add a business rule
- WHEN: before Insert/Update or Display (Your choice)
- Code:
//Get the values of your two objects
var curAccount = current.getValue('u_account');
var curCode = current.getValue('u_code');
//Set the display Value
current.setDisplayValue('u_display_name', curCode + '-' + curAccount);
current.update();

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-22-2018 11:01 AM
I don't think, you can set the display value as concatenation of two fields in the reference field.
One option would be to add the code field as well using ref_ac_columns, so that it shows up along with name, while selecting the account.
And also add the reference related field 'code' to the form just below the account name, so that user can see the code post selection.
The other option
I would create a third field 'Display Label' and make it display field in the Accounts table.
And add a business rule on that table to automatically concatenate the code and name, when someone insert or update the account code/name. If I have that business rule, there shouldn't be an issue while importing excel sheet as well.
Please mark this response as correct or helpful if it assisted you with your question.