+ Start a Discussion

Dynamic Default Values



On the Account object, I have a field called 'Language'. The requirement is to default this field with the logged in users languge.


Could someone please help me with the approach?


Thanks in advance.


If you always want it to be defaulted to the the logged in username you can write a formula field. This will always show the current user language.


I don't think u can access user's locale (language) in formula field! 

Coming to your requirement, is it a picklist field? Do you want to freeze it or default it? 

If you wanna default (pre-populate) it, then you might have to use an S-Control to do this.



Thank you for your replies.

Infact, there are 4-5 fields thats needs to be dynamically defaulted from User record.


@Cool_Devloper: Yes, it is not possible to access language field from User record. Not just language, there are many fields on User record which cannot be accessed using $User.


I had to create a visual page similar to Account Edit page and using some page scripts to default the fields. I'm not sure if this is the best way to do it. I'm very new to Salesforce and could only find this option.


Well, I now have a new issue. I'm not able to create apex:inputField for Account Owner and Record Type fields.


Any idea on how to do that?


Yes, that's the way to do it!

If you're not able to use inputFields for owner/recordtypes, then maybe you can create adrop down or a custom lookup and then when you are saving the record, save the selected values in the owner/recordType fields respectively;)



I just removed the Account Owner (default value-user id) and Record Type from the page. The user will not see the fields while creating the records but will see them as soon as the record is save.


Thanks a lot for your support.