Create Employee record using .net business connector using .net in ax 2009.

Hi All,

I wants to create a Employee record through .net business connector using .net in ax 2009.

how can i achieve this, need a help on this.

Thanks in advance.

Hello Sravya,

Using .net application you want to create the Employee record in AX 2009.

Hello Sravya,

By using .net application, below is the code it can be useful…

Axapta ax;
ax = new Axapta();
try
{
ax.logon();
AxaptaRecord EmpTable = ax.CreateAxaptaRecord(“EmpTable”);

EmpTable.Set_field(“EmpId”, “EmpId-001”);
EmpTable.Set_filed(“EmpName”,“Test Name”);
EmpTable.insert();
ax.logoff();
}
catch(Exception ex)
{
Console.Writline(ex.Message);
ax.logoff();
}

Hi,

Thanks for your reply.

I already tried the above process. it is inserting employee record.

But its not inserting DirPartyId.

How can i insert dirparty id when i creating Employee record through .net.

Thanks in Advance.

Hello Sravya,

Need to call the axapta methods in .net to create a new party id.

So here call the method “getNewPartyId” from the table “DirPartyTable” from .net using “ax.CallStaticClassMethod()”.

Hi Naresh,

Thank you so much for your reply.

The ax.callStaticClassMethod() asking a class name and method name .

In The method Name i can pass “getNewPartyId” , in the class name what class should i pass.

Syntax is : ax.CallStaticClassMethod(string classname,string methodName)

what class name should i pass for generation of Partyid.

Thanks in advance.

Hello Sravya,

In the case of table methods/static methods need to call as ax.Call() or ax.CallStaticRecordMethod().

Try this…

ax.CallStaticRecordMethod(“DirPartyTable”, “getNewPartyId”);

HI Naresh,

Thanks a lot my problem is solved.

Thank you.

Hi Sravya

for creating Employee through .Net BC use standard AXEmplTable class.