Discussions
Stay up-to-date with the latest news from NetSuite. You’ll be in the know about how to connect with peers and take your business to new heights at our virtual, in-person, on demand events, and much more.
New AI Community Guidelines. Please review and follow them to ensure AI use stays safe, accurate, and compliant.
Narrative Insights is Temporarily Unavailable due to an Infrastructure Issue. Learn how This Impacts Your Account and What to Expect While the Feature is Disabled.
C# How To Update Custom Record Fields
Using C# in Visual Studio 2008,
I created a custom "Record Type" Called "DevRecord" with the InternalID of 28, linked the Custom Record with customers, and a single Free Form Text field named "NameField" with the ID of "custrecord8".
See Image Bellow:
I created a record to a customer and I have been trying to update that field using the following code:
try { CustomRecordSearch customRecordSearch = new CustomRecordSearch(); RecordRef recordRef = new RecordRef(); recordRef.internalId = "28"; recordRef.type = RecordType.customRecord; customRecordSearch.basic = new CustomRecordSearchBasic(); customRecordSearch.basic.recType = recordRef; SearchResult result = mNetsuiteService.search(customRecordSearch); foreach (CustomRecord custRec in result.recordList) { CustomRecord cr = (CustomRecord)custRec; ArrayList cfs = new ArrayList(cr.customFieldList); for (int i = 0; i < cfs.Count; i++) { if (cfs[i].GetType().Name == "StringCustomFieldRef") { StringCustomFieldRef thisDate = (StringCustomFieldRef)cfs[i]; if (thisDate.internalId == "custrecord8") thisDate.value = "UpdatedValue"; } } CustomFieldRef[] myList = new CustomFieldRef[cfs.Count]; myList = (CustomFieldRef[])cfs.ToArray(typeof(CustomFieldRef)); cr.customFieldList = myList; cr.recType.typeSpecified = true; Preferences pref = new Preferences(); pref.ignoreReadOnlyFields = true; mNetsuiteService.preferences = pref; WriteResponse response 0