Sunday, May 26, 2019

C# > 2013.2 and Up > Adding a record of type custom record into NetSuite

If you have a custom record existing on your account and you would like to create a new record of that custom record and you wish to do this via C# the following code will show you how to do that.
Please note you will need a valid login session.

// Creating a custom record object.
CustomRecord myCR = new CustomRecord();

// Creating a RecordRef object with the internal ID of 2
// the internal ID is the ID of the custom record existing in your account.
RecordRef rf = new RecordRef();
rf.internalId = "2";

// Applying the RecordRef object to the Custom Record object.
myCR.recType = rf;

// Adding the custom record into NetSuite.
WriteResponse res = nss.add(myCR);

// Checking to see the status of the custom record being added to NetSuite.
if (res.status.isSuccess)
{
MessageBox.Show("Daily Activity created.");
}
else
{
MessageBox.Show(res.status.statusDetail[0].message, "Error");
}

No comments:

Post a Comment