How do you clear values from a field? I'm trying t...
# suitetalkapi
b
How do you clear values from a field? I'm trying to remove the value from a built-in date field and several custom fields (types are date and select/list). Here is an example:
Copy code
SelectCustomFieldRef myCustomField = new SelectCustomFieldRef { scriptId = "custentity_mycustomfield", value = new ListOrRecordRef { name = string.Empty } };
I tried setting value to null but found it's required. I've tried passing an empty
ListOrRecordRef
object. I've tried setting the name and internal id properties with null and empty strings. So far nothing has worked. What am I missing?
After way too much searching, I stumbled across the
nullFieldList
property which clears values from both standard and custom fields. That is exactly what I needed. It should have been easier to find in the documentation rather than a mention in a random forum post somewhere. At least I have a solution.
m
Check out the
nullFieldList
property. In C# it looks something like this:
Copy code
task.message = null;
task.nullFieldList = new string[] {"message"};
b
although i agree that the search is useless