Hi, Readers. Wish you get all the success this year. Hope that joy and success follow you in every sector of life. Happy New Year 2022!
Today I would like to talk about a simple topic, how to change default caption/name of existing field in Business Central. For example, the client wants to change the “No.”to “Item Number” and “Inventory” to “Stock” on the Item List, is it possible?
![](https://yzhums.com/wp-content/uploads/2022/01/image-1024x517.png)
Yes, but we can’t do this in standard features, we need small customizations. In this post, I will share two ways, hope this helps.
First let’s take a look at the standard Item List page and Item table.
On the Item list page:
![](https://yzhums.com/wp-content/uploads/2022/01/image-8-1009x1024.png)
![](https://yzhums.com/wp-content/uploads/2022/01/image-9-1024x434.png)
In Item table:
![](https://yzhums.com/wp-content/uploads/2022/01/image-10-1024x794.png)
![](https://yzhums.com/wp-content/uploads/2022/01/image-11-1024x394.png)
1. Using PageExtension to modify the caption of the field or add a new caption.
![](https://yzhums.com/wp-content/uploads/2022/01/image-2.png)
Source code:
pageextension 50100 ItemListExt extends "Item List"
{
layout
{
modify("No.")
{
Caption = 'Item Number';
}
modify(InventoryField)
{
Caption = 'Stock';
}
}
}
The caption will be changed.
![](https://yzhums.com/wp-content/uploads/2022/01/image-1-1024x517.png)
Note: This method affects all languages.
Test Video:
2. Using XLIFF translation file (.xlf file)
In the app.json file of your extension, add the following line:
“features”: [“TranslationFile”],
![](https://yzhums.com/wp-content/uploads/2022/01/image-3-826x1024.png)
Then package then extension.
![](https://yzhums.com/wp-content/uploads/2022/01/image-4-1024x177.png)
XLIFF file will be generated. Because the current extension does not contain any object, the generated translation file is empty.
![](https://yzhums.com/wp-content/uploads/2022/01/image-5-1024x215.png)
Copy a new file and change the value of orginial to “Base Application”.
![](https://yzhums.com/wp-content/uploads/2022/01/image-13-1024x302.png)
OK, the preparation work is done, the next step is a bit more complicated. You need to find standard translation files provided by Microsoft. The easiest way is to get this file from the On-Premise installation package.
~\Dynamics.365.BC.33504.W1.DVD\Applications\BaseApp\Source
![](https://yzhums.com/wp-content/uploads/2022/01/image-6-1024x487.png)
Base Application.en-US.xlf:
![](https://yzhums.com/wp-content/uploads/2022/01/image-7-1024x270.png)
The caption of “No.” in Item table.
![](https://yzhums.com/wp-content/uploads/2022/01/image-12-1024x206.png)
The caption of “Inventory” in Item table.
![](https://yzhums.com/wp-content/uploads/2022/01/image-14-1024x275.png)
Copy the required part into the translation file you just created, and then modify the target part to the text you need.
![](https://yzhums.com/wp-content/uploads/2022/01/image-15-1024x387.png)
Source code:
<?xml version="1.0" encoding="utf-8"?>
<xliff version="1.2" xmlns="urn:oasis:names:tc:xliff:document:1.2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:oasis:names:tc:xliff:document:1.2 xliff-core-1.2-transitional.xsd">
<file datatype="xml" source-language="en-US" target-language="en-US" original="Base Application">
<body>
<group id="body">
<trans-unit id="Table 3276313895 - Field 4200184881 - Property 2879900210" maxwidth="0" size-unit="char" translate="yes" xml:space="preserve">
<source>No.</source>
<target state="translated">Item Number</target>
<note from="Developer" annotates="general" priority="2"></note>
<note from="Xliff Generator" annotates="general" priority="3">Table Item - Field No. - Property Caption</note>
</trans-unit>
<trans-unit id="Table 3276313895 - Field 2105307182 - Property 2879900210" maxwidth="0" size-unit="char" translate="yes" xml:space="preserve">
<source>Inventory</source>
<target state="translated">Stock</target>
<note from="Developer" annotates="general" priority="2"></note>
<note from="Xliff Generator" annotates="general" priority="3">Table Item - Field Inventory - Property Caption</note>
</trans-unit>
</group>
</body>
</file>
</xliff>
The caption will be changed.
![](https://yzhums.com/wp-content/uploads/2022/01/image-16-1024x517.png)
END
Hope this will help.
Thanks for reading.
ZHU
コメント