My requirement was to automatically calculate the CountryCodePrefix
field based on the Country
field in a custom table called HAR_ManufacturedInStaging1
in D365 Finance and Operations (D365FO) when importing data from an Excel file.
Code Snippet:-
public class HAR_ManufacturedInStaging1 extends common
{
///
///
///
public void postLoad()
{
super();
if (this.Country)
{
// Extract the first 3 letters of the country name
this.CountryCodePrefix = subStr(this.Country, 1, 3);
}
else
{
this.CountryCodePrefix = " ";
}
}
}