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.
Now is the time to ask your NetSuite-savvy friends and colleagues to join the NetSuite Support Community! Refer now! Click here to watch and learn more!
Stay in the Know
Be sure you're subscribed to NetSuite communication to stay in the know about monthly happenings, updates and announcements. Subscribe
Be sure you're subscribed to NetSuite communication to stay in the know about monthly happenings, updates and announcements. Subscribe
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