//DIXF - cross company Data import Ax 2012
//Example for Customer Entity
Step -1
-->Add new field AXCompany to DMFCustomerEntity table
--> set the properties as follows
-->Mandatory - Yes
-->AllowEdit - No
Step -2
-->Add new method existsAXCompany to CustTable table
-->Code
static server boolean existsInCompany(
CustAccount _custAccount,
DataAreaId _dataAreaId)
{
boolean found;
changeCompany(_dataAreaId)
{
found = (select firstonly RecId from CustTable
index hint AccountIdx
where custTable.AccountNum == _custAccount).RecId != 0;
}
return found;
}
Step -3
-->Customize method insertUpdate of class DMFCustomerEntityClass
--> Code
public Common insertUpdate(Common _target, boolean _callInsertLogic = false, boolean _callValidateLogic = false)
{
Common ret;
CustTable custTable;
boolean isUpdate;
Set permissionSet; //Added by Admin on 08 05 2016 - mod
Boolean existsAXCompany; //Added by Admin on 08 05 2016 - Mod
if(target.RecId)
{
isUpdate = true;
}
//Added by Admin on 08 05 2016 - mod
permissionSet = newSet(Types::Class)
permissionSet.add(new OverwriteSystemFIeldsPermission());
CodeAccessPermission::assertMultiple(permissionSet);
if(_target.RecId)
{
custTable = _target as custTable;
existsAXCompany = custTable::existsAXCompany(custTable.AccountNum,entity.AXCompany);
}
ChangeCompany(entity.AXCompany)
{
_target.overwriteSystemFields(true);
_target.(filednum(common, dataAreaId)) == entity.AXCompany;
if(_target.RecId && !existsAXCompany)
{
_target.RecId = 0;
}
ret = super(_target, _callerInsertLogic, _CallValidateLogic);
}
//ret = super(_target, _callInsertLogic, _callValidateLogic);
//End Code - Mod
if (!this.parmIsCompare())
{
custTable = CustTable::find(entity.AccountNum);
if (custTable && (entity.AccountBalance != 0) && !isUpdate) //check for customer/Accountbalance
{
this.generateBalance();
}
}
return ret;
}
Step -4
-->Change the RunOn property of class DMFCustomerEntityClass to Server
Step -5
-->Create New processing group in DIXF
-->Select entities(customer entity) for processing group
-->Format as CSV
-->generate Source file
-->enter some sample customer data (Note: try to include different AXCompany name)
-->Genrate source mapping
-->preview source file
-->get staging data
-->Copy data to target
Step 6
--> verify data in imported Legal entity customer data
//Example for Customer Entity
Step -1
-->Add new field AXCompany to DMFCustomerEntity table
--> set the properties as follows
-->Mandatory - Yes
-->AllowEdit - No
Step -2
-->Add new method existsAXCompany to CustTable table
-->Code
static server boolean existsInCompany(
CustAccount _custAccount,
DataAreaId _dataAreaId)
{
boolean found;
changeCompany(_dataAreaId)
{
found = (select firstonly RecId from CustTable
index hint AccountIdx
where custTable.AccountNum == _custAccount).RecId != 0;
}
return found;
}
Step -3
-->Customize method insertUpdate of class DMFCustomerEntityClass
--> Code
public Common insertUpdate(Common _target, boolean _callInsertLogic = false, boolean _callValidateLogic = false)
{
Common ret;
CustTable custTable;
boolean isUpdate;
Set permissionSet; //Added by Admin on 08 05 2016 - mod
Boolean existsAXCompany; //Added by Admin on 08 05 2016 - Mod
if(target.RecId)
{
isUpdate = true;
}
//Added by Admin on 08 05 2016 - mod
permissionSet = newSet(Types::Class)
permissionSet.add(new OverwriteSystemFIeldsPermission());
CodeAccessPermission::assertMultiple(permissionSet);
if(_target.RecId)
{
custTable = _target as custTable;
existsAXCompany = custTable::existsAXCompany(custTable.AccountNum,entity.AXCompany);
}
ChangeCompany(entity.AXCompany)
{
_target.overwriteSystemFields(true);
_target.(filednum(common, dataAreaId)) == entity.AXCompany;
if(_target.RecId && !existsAXCompany)
{
_target.RecId = 0;
}
ret = super(_target, _callerInsertLogic, _CallValidateLogic);
}
//ret = super(_target, _callInsertLogic, _callValidateLogic);
//End Code - Mod
if (!this.parmIsCompare())
{
custTable = CustTable::find(entity.AccountNum);
if (custTable && (entity.AccountBalance != 0) && !isUpdate) //check for customer/Accountbalance
{
this.generateBalance();
}
}
return ret;
}
Step -4
-->Change the RunOn property of class DMFCustomerEntityClass to Server
Step -5
-->Create New processing group in DIXF
-->Select entities(customer entity) for processing group
-->Format as CSV
-->generate Source file
-->enter some sample customer data (Note: try to include different AXCompany name)
-->Genrate source mapping
-->preview source file
-->get staging data
-->Copy data to target
Step 6
--> verify data in imported Legal entity customer data
No comments:
Post a Comment