Sunday, May 26, 2019

C# > 2013.2 and Up > Getting a list of all employees on your account.

If you would like to get a list of all employee records on your account you can use the following code.
Please note you will need to have a valid login session and if you have more then 100 employee's you will need to create a searchPreference Object.
If you wish to look for employees that have something unique about the record you should be using the EmployeeSearchBasic or EmployeeSearchAdvanced.

// Logging into NetSuite.
Status stat = nss.login(p).status;

// Checking the Status of the login
if (stat.isSuccess)
{
// Creating an Employee Search Object.
EmployeeSearch es = new EmployeeSearch();

// Sending in the search request for employee's
SearchResult res = nss.search(es);

// Checking the status of search Results.
if (res.status.isSuccess)
{
Console.Write("Employee Search Successful");
Console.ReadKey();
}
else
{
Console.Write(res.status.statusDetail[0].message);
Console.ReadKey();
}
}

No comments:

Post a Comment