You need to sign in to do that
Don't have an account?
Subramani_SFDC
get null value from database.query
String a= 'SELECT ' + strfield +' FROM ' + sobjectName + ' WHERE Id = :strid';
how can i get NULL value records also using Database.query() ?
suppose the contact is sobjectName and strfield result is lastname,firstname right?
if i query the lastname and firstname . but the firstname is null means i need to display that value also using database.query...
Any help is much appreciated
how can i get NULL value records also using Database.query() ?
suppose the contact is sobjectName and strfield result is lastname,firstname right?
if i query the lastname and firstname . but the firstname is null means i need to display that value also using database.query...
Any help is much appreciated
1. First Name is NOT required field on contact, but last name is required field. It means you can not save any contact without last name, but you can save any contact without first name.
2. Suppose there are multiple contacts saved in your Salesforce org and you are querying those records. Your Query result will show you only Last name.
You see null value in First name field because there must not be any first name for that contact.
Thanks & Regards,
Sameer Tyagi
http://mirketa.com/
pls see my above query
String a= 'SELECT ' + strfield +' FROM ' + sobjectName + ' WHERE Id = :strid';
strfield may any object field and sobjectname is any object name.
i am using this inside email content section ..i want to show the values as dynamic from the above query (also includes if field name left blank it should show as null value). suppose i left the firstname it should show as null in Email content ( dynamically displaying values )
can you catch my point??
If you are querying any field value on any object which is blank and You are dynamically using that fieldvalue inside Email content.
Then Email contact will display Null on that place.
If you do not want to show Null or Blank on that place in your Email, You can set any static value.
For Example
List<Contact> sobjList = Database.query('Select phone from contact limit 1');
String phone = sobjList[0].phone;
if(phone == null || phone == '');
phone == '1232435';
now it will show 1232435 on that place
Sameer