[Form]
public class KMTShipFromWarehouses extends FormRun
{
InventDimCtrl_Frm_EditDimensions inventDimFormSetup;
/// <summary>
/// InventDimFormDesignUpdate
/// </summary>
/// <returns></returns>
public InventDimCtrl_Frm_EditDimensions inventDimSetupObject()
{
return inventDimFormSetup;
}
/// <summary>
/// InventDimFormDesignUpdate
/// </summary>
public void init()
{
super();
// This method will be used to show default fields at form startup
element.updateDesign(InventDimFormDesignUpdate::Init);
}
/// <summary>
/// To Display product dimensions
/// </summary>
/// <param name = "mode">InventDimFormDesignUpdate</param>
void updateDesign(InventDimFormDesignUpdate mode)
{
InventDimParm inventDimParmVisible;
switch (mode)
{
// Form Init
case InventDimFormDesignUpdate::Init:
if(!inventDimFormSetup)
{
inventDimFormSetup = InventDimCtrl_Frm_EditDimensions::newFromForm(element);
inventDimFormSetup.parmSkipOnHandLookUp( true);
// Use the methods on InventDimParm
// to set which dimensions to show when form is initialized
inventdimparmvisible.InventSizeIdFlag = true;
inventdimparmvisible.InventColorIdFlag = true;
inventdimparmvisible.InventSiteIdFlag = true;
inventdimparmvisible.InventLocationIdFlag = true;
inventDimFormSetup.parmDimParmVisibleGrid(inventDimParmVisible);
}
// Datasource Active
case InventDimFormDesignUpdate::Active :
inventDimFormSetup.formActiveSetup(InventDimGroupSetup::newItemId(KMTShipFromWarehouses.ItemId)); //InventDimDisplay is the datasource name.
inventDimFormSetup.formSetControls( true);
break;
// Datasource Field change
case InventDimFormDesignUpdate::FieldChange :
inventDimFormSetup.formActiveSetup(InventDimGroupSetup::newItemId(KMTShipFromWarehouses.ItemId)); //InventDimDisplay is the datasource name.
InventDim.clearNotSelectedDim(inventDimFormSetup.parmDimParmEnabled()); // InventDim is referring to datasource name
inventdimparmvisible.InventSizeIdFlag = true;
inventdimparmvisible.InventColorIdFlag = true;
inventdimparmvisible.InventSiteIdFlag = true;
inventdimparmvisible.InventLocationIdFlag = true;
inventDimFormSetup.formSetControls( true);
break;
default :
throw error(strFmt ("@SYS54195", funcName()));
}
}
[DataSource]
class KMTShipFromWarehouses
{
/// <summary>
/// To Display product dimensions
/// </summary>
public int active()
{
int ret;
ret = super();
element.updateDesign(InventDimFormDesignUpdate::Active);
//If record is saved then allow edit for dimension field is false.
if (KMTShipFromWarehouses_ds.cursor())
{
this.formRun().design(0).controlName('InventoryDimensionsGrid_InventSizeId').allowEdit(false);
this.formRun().design(0).controlName('InventoryDimensionsGrid_InventColorId').allowEdit(false);
}
return ret;
}
[DataField]
class ItemId
{
/// <summary>
/// To Display product dimensions
/// </summary>
public void modified()
{
super();
element.updateDesign(InventDimFormDesignUpdate::FieldChange);
InventDim.clearNotSelectedDim(element.inventDimSetupObject().parmDimParmEnabled());
}
}
}
[DataSource]
class InventDim
{
[DataField]
class InventSizeId
{
/// <summary>
/// To display site and warehouse
/// </summary>
public void modified()
{
InventTable inventTable = inventTable::find(KMTShipFromWarehouses.ItemId);
InventItemOrderSetupType setupType = InventItemOrderSetupType::Invent;
super();
inventDim.InventSiteId = inventTable.inventItemOrderSetupMap(setupType).inventSiteId(inventDim.InventSiteId, inventTable);
inventDim.InventLocationId = inventTable.inventItemOrderSetupMap(setupType,InventDim::findOrCreate(inventDim).InventDimId).inventLocationId(inventDim.InventLocationId,inventTable,inventDim.InventSiteId);
}
}
}
}
Validate Write method on table
/// <summary>
/// Validate the required fields
/// </summary>
/// <returns>Boolean</returns>
public boolean validateWrite()
{
boolean ret = true;
str errorMessage;
InventTable inventTable;
InventDimParm inventDimParm;
inventTable = InventTable::find(this.ItemId);
inventDimParm = InventDimParm::activeDimFlag(InventDimGroupSetup::newInventTable(inventTable));
InventDim kmtInventDim = InventDim::find(this.InventDimId);
if(inventDimParm.InventSizeIdFlag && !kmtInventDim.InventSizeId)
{
errorMessage = strFmt("@SYS26332", Fieldid2PName(tableNum(InventDim),fieldNum(InventDim, InventSizeId)));
}
if(inventDimParm.InventColorIdFlag && !kmtInventDim.InventColorId)
{
errorMessage = errorMessage + " " + strFmt("@SYS26332", Fieldid2PName(tableNum(InventDim),fieldNum(InventDim, InventColorId)));
}
if(kmtInventDim.InventSiteId && !kmtInventDim.InventLocationId)
{
errorMessage = errorMessage + " " + strFmt("@SYS26332", Fieldid2PName(tableNum(InventDim),fieldNum(InventDim, InventLocationId)));
}
if(errorMessage)
{
ret = checkFailed(errorMessage);
}
else
{
ret = super();
}
return ret;
}
public class KMTShipFromWarehouses extends FormRun
{
InventDimCtrl_Frm_EditDimensions inventDimFormSetup;
/// <summary>
/// InventDimFormDesignUpdate
/// </summary>
/// <returns></returns>
public InventDimCtrl_Frm_EditDimensions inventDimSetupObject()
{
return inventDimFormSetup;
}
/// <summary>
/// InventDimFormDesignUpdate
/// </summary>
public void init()
{
super();
// This method will be used to show default fields at form startup
element.updateDesign(InventDimFormDesignUpdate::Init);
}
/// <summary>
/// To Display product dimensions
/// </summary>
/// <param name = "mode">InventDimFormDesignUpdate</param>
void updateDesign(InventDimFormDesignUpdate mode)
{
InventDimParm inventDimParmVisible;
switch (mode)
{
// Form Init
case InventDimFormDesignUpdate::Init:
if(!inventDimFormSetup)
{
inventDimFormSetup = InventDimCtrl_Frm_EditDimensions::newFromForm(element);
inventDimFormSetup.parmSkipOnHandLookUp( true);
// Use the methods on InventDimParm
// to set which dimensions to show when form is initialized
inventdimparmvisible.InventSizeIdFlag = true;
inventdimparmvisible.InventColorIdFlag = true;
inventdimparmvisible.InventSiteIdFlag = true;
inventdimparmvisible.InventLocationIdFlag = true;
inventDimFormSetup.parmDimParmVisibleGrid(inventDimParmVisible);
}
// Datasource Active
case InventDimFormDesignUpdate::Active :
inventDimFormSetup.formActiveSetup(InventDimGroupSetup::newItemId(KMTShipFromWarehouses.ItemId)); //InventDimDisplay is the datasource name.
inventDimFormSetup.formSetControls( true);
break;
// Datasource Field change
case InventDimFormDesignUpdate::FieldChange :
inventDimFormSetup.formActiveSetup(InventDimGroupSetup::newItemId(KMTShipFromWarehouses.ItemId)); //InventDimDisplay is the datasource name.
InventDim.clearNotSelectedDim(inventDimFormSetup.parmDimParmEnabled()); // InventDim is referring to datasource name
inventdimparmvisible.InventSizeIdFlag = true;
inventdimparmvisible.InventColorIdFlag = true;
inventdimparmvisible.InventSiteIdFlag = true;
inventdimparmvisible.InventLocationIdFlag = true;
inventDimFormSetup.formSetControls( true);
break;
default :
throw error(strFmt ("@SYS54195", funcName()));
}
}
[DataSource]
class KMTShipFromWarehouses
{
/// <summary>
/// To Display product dimensions
/// </summary>
public int active()
{
int ret;
ret = super();
element.updateDesign(InventDimFormDesignUpdate::Active);
//If record is saved then allow edit for dimension field is false.
if (KMTShipFromWarehouses_ds.cursor())
{
this.formRun().design(0).controlName('InventoryDimensionsGrid_InventSizeId').allowEdit(false);
this.formRun().design(0).controlName('InventoryDimensionsGrid_InventColorId').allowEdit(false);
}
return ret;
}
[DataField]
class ItemId
{
/// <summary>
/// To Display product dimensions
/// </summary>
public void modified()
{
super();
element.updateDesign(InventDimFormDesignUpdate::FieldChange);
InventDim.clearNotSelectedDim(element.inventDimSetupObject().parmDimParmEnabled());
}
}
}
[DataSource]
class InventDim
{
[DataField]
class InventSizeId
{
/// <summary>
/// To display site and warehouse
/// </summary>
public void modified()
{
InventTable inventTable = inventTable::find(KMTShipFromWarehouses.ItemId);
InventItemOrderSetupType setupType = InventItemOrderSetupType::Invent;
super();
inventDim.InventSiteId = inventTable.inventItemOrderSetupMap(setupType).inventSiteId(inventDim.InventSiteId, inventTable);
inventDim.InventLocationId = inventTable.inventItemOrderSetupMap(setupType,InventDim::findOrCreate(inventDim).InventDimId).inventLocationId(inventDim.InventLocationId,inventTable,inventDim.InventSiteId);
}
}
}
}
Validate Write method on table
/// <summary>
/// Validate the required fields
/// </summary>
/// <returns>Boolean</returns>
public boolean validateWrite()
{
boolean ret = true;
str errorMessage;
InventTable inventTable;
InventDimParm inventDimParm;
inventTable = InventTable::find(this.ItemId);
inventDimParm = InventDimParm::activeDimFlag(InventDimGroupSetup::newInventTable(inventTable));
InventDim kmtInventDim = InventDim::find(this.InventDimId);
if(inventDimParm.InventSizeIdFlag && !kmtInventDim.InventSizeId)
{
errorMessage = strFmt("@SYS26332", Fieldid2PName(tableNum(InventDim),fieldNum(InventDim, InventSizeId)));
}
if(inventDimParm.InventColorIdFlag && !kmtInventDim.InventColorId)
{
errorMessage = errorMessage + " " + strFmt("@SYS26332", Fieldid2PName(tableNum(InventDim),fieldNum(InventDim, InventColorId)));
}
if(kmtInventDim.InventSiteId && !kmtInventDim.InventLocationId)
{
errorMessage = errorMessage + " " + strFmt("@SYS26332", Fieldid2PName(tableNum(InventDim),fieldNum(InventDim, InventLocationId)));
}
if(errorMessage)
{
ret = checkFailed(errorMessage);
}
else
{
ret = super();
}
return ret;
}
Thank you for sharing wonderful information with us to get some idea about that content.
ReplyDeleteMicrosoft Dynamics AX Technical Training
Microsoft Dynamics AX Technical Training in Hyderabad
MS Dynamics Technical Online Training
MS Dynamics AX Technical Training in Hyderabad
MS Dynamics AX Online Training
D365 AX Online Training
Nice blog. You have provided such a useful information in this blog. Thanks for sharing.
ReplyDeleteD365 Finance and Operations Online Training
D365 Finance and Operations Training in Hyderabad
D365 Operations Training
https://www.youtube.com/playlist?list=PLWSxgDbjVWTjxvgnaAZ0iK8o5dYHAYhrq
ReplyDeleteCollection of Microsoft ERP Clips || ERP Licensing, Technical, Functional ,Manager Learning Videos Listing