You need to sign in to do that
Don't have an account?
Mascotte
Update problem when a field becomes null
Hi !
I create an object and specify a particular Field.
For exemple I create an Opportunity, specifying the description field.
The object is well created and the description field is set to a value.
When I update this object, I can change the value of the field without any problem.
But if the new value is null (typicaly an empty Textbox), the field is not set to null on update,
containing the same value as before the update !!!
I tried this:
if (DescriptionBox.Text.Length == 0)
MyOpportunity = null;
Doesn't work :(
Any idea about my problem ?
Thank you in advance.
Matthias.
I create an object and specify a particular Field.
For exemple I create an Opportunity, specifying the description field.
The object is well created and the description field is set to a value.
When I update this object, I can change the value of the field without any problem.
But if the new value is null (typicaly an empty Textbox), the field is not set to null on update,
containing the same value as before the update !!!
I tried this:
if (DescriptionBox.Text.Length == 0)
MyOpportunity = null;
Doesn't work :(
Any idea about my problem ?
Thank you in advance.
Matthias.
Hi,
Were you able to finally figure this out? i have a similar issue.
Please let me know.
thanks in advance.
It is absolutely not userfriendly, but quite simple:
Each time you want to erase a field, add the fieldname to the string[] table:
Code:
Hi,
thanks for the quick response.
ok. i am retrieving custom fields from contact object. And if my custom fields are empty its gives me following error.
nullable object must have a value.
I am using following code to prevent the program from crashing. But its not working.
contact.User_ID__c = ""
contact.User_ID__cSpecified = True
cmd.Parameters.AddWithValue("@UserId", contact.User_ID__c)
Else
cmd.Parameters.AddWithValue("@UserId", contact.User_ID__c)
contact.User_ID__cSpecified = True
End If
i would really appreciate any suggestion .
thanks
Code:
thanks for trying to help me again.
No but i did not work.
if my custom field is empty , ie userid (doble) is empty i am getting following error. nullable object must have a value.
how can i prevent my program from crashing if there is a empty field coming in from sales force.
thanks
The field I am working with is account.NumberOfEmployees. My program takes the existing number of employees, increases it by 1 and updates the account. However, if the field is null "nullable object must have a value."
I want to use an If Then statement to determine if the field's value is null and set it to 1 if it is.
I haven't finished looking into it yet, but if anyone knows the answer immediately I'm sure future people will find it helpful.
see http://msdn2.microsoft.com/en-us/library/b3h38hb0.aspx
Hi
I am having the same problem. Have you got a soultion for it? If you do, please tell me how you overcome it.
Thank you.
Brgrds
Js