Monday, August 24, 2009

Gender information in Employees-form and the Global Address Book (GAB)

You can open the information about employees with the Global Address Book (Basic/Global Address Book) and with the Employees form (Basic/Employees).
Normally it is no problem to modify data in both forms, but unfortunately this is not true for the ‘gender’ property. This information is stored in the DirPersonPartyDetail (Gender) and EmplTable (EmplGender) table. The particularity here is, that the EmplGender property is of type ‘EmplGender’ which has two states (0:Male;1:Female) and the enum ‘Gender’ has three states (0:unknown;1:male;2:female).
If you know change the value for the gender in the GAB it won’t change the value for ‘EmplGender’ and if you change it through the Employees-form it won’t change the value for ‘Gender’.
This is why the gender information of employees must be modified with the Employees-form and not with the GAB.
If you need to synchronize the employees information with the GAB, you can add at the end of the method (tables\EmplTable\ValidateField), the following code :
1: //MODIFICATION(04/08/2009): Empl-form is not synchronizing some values with the GAB
2: case(fieldnum(EmplTable, emplGender)):
3: dirPersonPartyDetail = DirPersonPartyDetail::find(this.PartyId, true);
4: if(dirPersonPartyDetail)
5: {
6: dirPersonPartyDetail.Gender = enum2int(this.EmplGender);
7: dirPersonPartyDetail.update();
8: }
9: break;
10: //END MODIFICATION

No comments:

How to identify the user that was used to change an object from AOT in AX2012

Get the object name for which we need to track these (user and date&time) information's. Login to SQL Server Management Studio an...