how to sync FO custom field in D365 fo Retail Database
so i have a requirement to push extension field data to channel database so we can use in POS side.
for this what i have done is defined below
these are the custom field in D365 fo table.
this is the custom table contain all that custom field
and save data per company is set to no
a custom field is created for dataareaId due to some reasons.
[ExtensionOf(tableStr(CustParameters))]
final class CustParameters_SIL_TUCustomizations_Extension
{
void update()
{
next update();
this.createOrUpdateTUCustParametersExt(this);
}
public void createOrUpdateTUCustParametersExt(CustParameters _CustParameters)
{
TUCustParametersExt TUCustParametersExt;
select * from TUCustParametersExt where TUCustParametersExt.RefRecid == this.RecId;
if(TUCustParametersExt)
{
ttsbegin;
TUCustParametersExt.selectForUpdate(true);
TUCustParametersExt.TU_BaseURL =_CustParameters.TU_BaseURL;
TUCustParametersExt.TU_Email =_CustParameters.TU_Email;
TUCustParametersExt.TU_FullName =_CustParameters.TU_FullName;
TUCustParametersExt.TU_OrgId =_CustParameters.TU_OrgId;
TUCustParametersExt.TU_Password =_CustParameters.TU_Password;
TUCustParametersExt.TU_Role =_CustParameters.TU_Role;
TUCustParametersExt.Key =_CustParameters.Key;
TUCustParametersExt.CompanyId =_CustParameters.DataAreaId;
TUCustParametersExt.update();
ttscommit;
}
else
{
TUCustParametersExt.TU_BaseURL =_CustParameters.TU_BaseURL;
TUCustParametersExt.TU_Email =_CustParameters.TU_Email;
TUCustParametersExt.TU_FullName =_CustParameters.TU_FullName;
TUCustParametersExt.TU_OrgId =_CustParameters.TU_OrgId;
TUCustParametersExt.TU_Password =_CustParameters.TU_Password;
TUCustParametersExt.TU_Role =_CustParameters.TU_Role;
TUCustParametersExt.RefRecid =_CustParameters.RecId;
TUCustParametersExt.Key =_CustParameters.Key;
TUCustParametersExt.CompanyId =_CustParameters.DataAreaId;
TUCustParametersExt.insert();
}
}
}
after that create the same table in channel database like this
<RetailCdxSeedData ChannelDBMajorVersion="7" ChannelDBSchema="ext" Name="AX7">
<Jobs>
</Jobs>
<Subjobs>
<Subjob Id="TUCustParameterSeedData" TargetTableSchema="ext" AxTableName="TUCustParametersExt" TargetTableName="TUCustParametersExt">
<ScheduledByJobs>
<ScheduledByJob>1110</ScheduledByJob>
</ScheduledByJobs>
<AxFields>
<Field Name="KEY"/>
<Field Name="CompanyId"/>
<Field Name="TU_EMAIL"/>
<Field Name="TU_PASSWORD"/>
<Field Name="TU_FULLNAME"/>
<Field Name="TU_ORGID"/>
<Field Name="TU_ROLE"/>
<Field Name="TU_BASEURL"/>
<Field Name="REfRECID"/>
<Field Name="RECID"/>
</AxFields>
</Subjob>
</Subjobs>
</RetailCdxSeedData>
after that we need to do create a resouse file in FO and attach that xml with it
than we need to create event handler class
inside that pasted this method
[SubscribesTo(classStr(RetailCDXSeedDataBase), delegateStr(RetailCDXSeedDataBase, registerCDXSeedDataExtension))]
public static void RetailCDXSeedDataBase_registerCDXSeedDataExtension_TU(str originalCDXSeedDataResource, List resources)
{
if (originalCDXSeedDataResource == resourceStr(RetailCDXSeedDataAX7))
{
//4 march 2026 added to get sms Credential in POS (Custom Fields)
resources.addEnd(resourceStr(TUCustParameterExtCDXSeedDataAX7_Extenstion));
}
}
replace your resource file name instead of "TUCustParameterExtCDXSeedDataAX7_Extenstion"
in above method.
than build this and go to FO and run
Regards
Muhammad Farraz
farazjaved01@gmail.com
Comments
Post a Comment