You need to sign in to do that
Don't have an account?
Paladyr
How to check if sforce object contact has nothing filled in for the account information?
I'm getting an error, object reference not set to an instance of an object when I reference the sforce contact object and the Account object inside the contact is not set to anything. So basically the contact info is filled into the object, but there is no account object attached to it. I've tried: If not sfContact.Account is nothing If not sfContact.Account.custom_field__c is nothing Neither catches when the Account object is set to nothing. How do I prevent code from being run when the Account object on a contact has not been filled in? I know I could change my query to prevent it from downloading a contact not linked to an account but I would like to know how to do this for future reference. Thanks!
Hi, you could check array size return from queryresult.
String groupByQuery = "SELECT Account.Name n, " +
"MAX(Amount) max, MIN(Amount) min " +
"FROM Opportunity GROUP BY Account.Name";
QueryResult qr = connection.query(groupByQuery);
if (qr.getSize() > 0) {
// do something
}
Which WSDL you are using? Partner or Enterprize? I guess you must be using Enterprize?
Partner WSDL
In C# you would compare sfCotact.Account to null and then sfContact.Account.custom_field__c to null. Not sure what the equivalent in vb.net is.
I wonder if you can put the sfContact.Account into a string value, then check the length != 0. (should be 18 if it has a value)
in VB.Net the "is nothing" is similar to the C# " == null", but i'm wondering if it is an exact match. Can you try " = nothing" (not sure if that compiles.)