Hi guys, Today we see how to Add Code in Standard Table using COC in AX7/D365fo.
Check the Below Example.
[ExtensionOf(tableStr(CustGroup))]
Final class CustGroup_Extension
{
[SysClientCacheDataMethod(true)]
display Name displayName()
{
return this.CustGroup + ' ' + this.PaymTermId;
}
void initValue()
{
// pre event
next initValue();
//Post event
this.NoYes = NoYes::Yes;
}
public void modifiedField(FieldId _fieldId)
{
next modifiedField(_fieldId);
switch (_fieldId)
{
case fieldnum(CustGroup, NoYes):
this.PriceIncludeSalesTax = this.NoYes == NoYes::Yes ?
NoYes::Yes : NoYes::no;
break;
}
}
public boolean validateWrite()
{
boolean ret = next validateWrite();
if(!this.TaxGroupId)
{
ret = checkFailed('Tax group is mandatory');
}
return ret;
}
public boolean validateField(FieldId _fieldIdToCheck)
{
boolean ret;
ret = next validateField(_fieldIdToCheck);
switch (_fieldIdToCheck)
{
case fieldnum(CustGroup, Name):
if (this.NoYes == NoYes::Yes)
{
if(this.Name =="")
{
ret = ret && checkFailed('when check box is yes
this field is mandatory');
}
}
}
return ret;
}
}
Keep Daxing!!
No comments:
Post a Comment