You need to sign in to do that
Don't have an account?
Kiru535
Not able to get field value in SOQL query
My requirement was to display picklist values based on user object. In User object Field called ASM__C (Formula Field) and I am retrieving the records based on this field. But I am getting Null value. The values are exist in database for this field.
Please guide me how to get the value...
This is my code-:
public class ManageAccountAssignmentsController
{
public String selectedAsm{get;set;}
//Public String AsmId{get;set;}
Public List<Account> AsmAssocAccounts{get;set;}
Public boolean MethCal{get;Set;}
Public boolean successMsg{get;Set;}
public Document document {get; set;}
public List<SelectOption> getAsmOptions()
{
Set<Id> accset = new Set<Id>();
Id customerRecordTypeId = Schema.SObjectType.Account.RecordTypeInfosByName.get('Customer').RecordTypeId;
List<Account> acct = New List<Account>();
Set<id> ArConId = new Set<id>();
acct = [Select Name, Ownerid, id from Account where RecordTypeId =:customerRecordTypeId];
for(Account acclst:acct)
{
accset.add(acclst.Ownerid);
}
List<SelectOption> options = new List<SelectOption>();
for (User e1:[SELECT Name,id,Area_Controller__c,ASM__c FROM User WHERE id IN:accset])
{
ArConId.add(e1.ASM__c); //Getting Null in this Set eventhough value is present in database
system.debug('ArConId'+ArConId);
}
options.add(new selectOption('--None--','--None--'));
for (User e:[SELECT Name,Id FROM User WHERE id IN:ArConId])
{
options.add(new selectOption(e.id,e.Name));
}
return options;
}
Please guide me how to get the value...
This is my code-:
public class ManageAccountAssignmentsController
{
public String selectedAsm{get;set;}
//Public String AsmId{get;set;}
Public List<Account> AsmAssocAccounts{get;set;}
Public boolean MethCal{get;Set;}
Public boolean successMsg{get;Set;}
public Document document {get; set;}
public List<SelectOption> getAsmOptions()
{
Set<Id> accset = new Set<Id>();
Id customerRecordTypeId = Schema.SObjectType.Account.RecordTypeInfosByName.get('Customer').RecordTypeId;
List<Account> acct = New List<Account>();
Set<id> ArConId = new Set<id>();
acct = [Select Name, Ownerid, id from Account where RecordTypeId =:customerRecordTypeId];
for(Account acclst:acct)
{
accset.add(acclst.Ownerid);
}
List<SelectOption> options = new List<SelectOption>();
for (User e1:[SELECT Name,id,Area_Controller__c,ASM__c FROM User WHERE id IN:accset])
{
ArConId.add(e1.ASM__c); //Getting Null in this Set eventhough value is present in database
system.debug('ArConId'+ArConId);
}
options.add(new selectOption('--None--','--None--'));
for (User e:[SELECT Name,Id FROM User WHERE id IN:ArConId])
{
options.add(new selectOption(e.id,e.Name));
}
return options;
}
Verify field level security for "ASM__c" field for running user profile.
Best Regards,
Mithun.
--
Magulan Duraipandian
www.infallibletechie.com
Field level security is fine.....
User there in the Account
Except this field data I am able to get the other fields data...
Please suggest any solution..
Regards,
Kiran.