Sunday, May 26, 2019

C# > 2013.2 and Up > Retrieve an employee record from your account.

If you would like to retrieve only a single employee record that exists in your account the following code will show you how to make the get request to retrieve the record.
Please note you will need a valid login session.

// Logging into NetSuite Account.
Status stat = nss.login(p).status;
if (stat.isSuccess == true)
{
// Creating a Record Object.
InitializeRef rec = new InitializeRef();

// Specifying the type of record.
rec.type = InitializeRefType.employee;

// Specifying that you have specified the type of record.
rec.typeSpecified = true;

// Passing the internal Id of the employee
rec.internalId = "263";

// Sending the Get Request into NetSuite
ReadResponse res = nss.get(rec);

// Checking the status of the Get Request.
if (res.status.isSuccess)
{
Console.Write("Employee Retrieved");
Console.ReadKey();
}
else
{
Console.Write(res.status.statusDetail[0].message);
Console.ReadKey();
}
}

No comments:

Post a Comment