Discussions
- General Development
- Schema Development
- Apex Code Development
- Visualforce Development
- Formulas & Validation Rules
- Security
- Mobile
- Force.com Sites & Site.com
- Chatter Development
- Java Development
- .NET Development
- Perl, PHP, Python & Ruby
- Desktop Integration
- APIs and Integrations
- Visual Workflow
- Apple, Mac and OS X
- VB and Office Development
- AppExchange Directory & Packaging
- Salesforce Labs & Open Source Projects
- Other Salesforce Applications
- Jobs Board
- Force.com Discussion Boards
- :
- Developer Boards for Force.com and Database.com
- :
- Apex Code Development
- :
- Compile Error: Field is not writeable: in User add...
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic to the Top
- Bookmark
- Subscribe
- Printer Friendly Page
Compile Error: Field is not writeable: in User add method
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
02-05-2013 03:28 AM
Hi
I cretaed chatter groups. When i select chatter group , it needs to display all member in that group i need to display user imges
I get userid from for loop from that i need to get user image.
In my case in a group , it may contain more than one user ,
so that i put in for loop and need to get and process so i have created User[] and add the results But i get error. I am unable to process further . Help Required.
Compile Error: Field is not writeable: user.name
public List<User> chatGroupUser{get;set;}
public User[] usG{get;set;}
public List<CollaborationGroupMember> chatCollabGroup{get;set;}
public string chattergroupMember;
public string chatterArray{get;set;}
public List<string> chatterStringList{get;set;}
public void chatterMemberSelection(){
chattergroupMember = ApexPages.currentPage().getParameters().get('chatt
for(CollaborationGroupMember a:[select CollaborationGroupId,CollaborationRole, MemberId,NotificationFrequency from CollaborationGroupMember where CollaborationGroupId IN(select id from collaborationgroup where name=:chattergroupMember)])
{
chatGroupUser =[SELECT Name,id FROM User where id=:a.MemberId];
// error in the following line
usG.add(new User(Name=chatGroupUser.name,id=chatGroupUser.id));
}
Re: Compile Error: Field is not writeable: in User add method
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
02-05-2013 03:38 AM
http://login.salesforce.com/help/doc/en/salesforce
I suspect you'll need to populate some more fields to add a user - profile for example. The fields I usually set up are:
alias
emailencodingkey
lastname
languagelocalekey
localesidkey
profileid
timezonesidkey
username
Certified Salesforce Technical Architect, Developer, Advanced Developer, Administrator, Advanced Administrator, Consultant, Sales Cloud Consultant,Service Cloud Consultant
Force.com MVP | The Bob Buzzard Blog | Linked In | Twitter
I don't respond to private messages/emails asking for help.
Take the Bob Buzzard Sobject Fields quiz.
Re: Compile Error: Field is not writeable: in User add method
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
02-05-2013 04:35 AM
Hi
I used FirstName ,FullPhotoUrl and other specified fields but unable to get proper answer
Re: Compile Error: Field is not writeable: in User add method
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
02-05-2013 04:38 AM
Certified Salesforce Technical Architect, Developer, Advanced Developer, Administrator, Advanced Administrator, Consultant, Sales Cloud Consultant,Service Cloud Consultant
Force.com MVP | The Bob Buzzard Blog | Linked In | Twitter
I don't respond to private messages/emails asking for help.
Take the Bob Buzzard Sobject Fields quiz.
Re: Compile Error: Field is not writeable: in User add method
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
02-05-2013 04:45 AM
Hi
chatGroupUser =[SELECT FirstName FROM User where id=:a.MemberId];
// error in the following line
usG.add(new User(FirstName=chatGroupUser.FirstName));
same error occured
Re: Compile Error: Field is not writeable: in User add method
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
02-05-2013 05:14 AM
Certified Salesforce Technical Architect, Developer, Advanced Developer, Administrator, Advanced Administrator, Consultant, Sales Cloud Consultant,Service Cloud Consultant
Force.com MVP | The Bob Buzzard Blog | Linked In | Twitter
I don't respond to private messages/emails asking for help.
Take the Bob Buzzard Sobject Fields quiz.
Re: Compile Error: Field is not writeable: in User add method
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
02-05-2013 05:26 AM
yes
Re: Compile Error: Field is not writeable: in User add method
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
02-05-2013 05:42 AM
I ran the following in my dev org which worked for me - no issue with writing to the fields:
Profile p = [select id from Profile where name='Chatter Free User'];
User u = new User(alias = 'utest', email='Unit.Test@unittest.com',
emailencodingkey='UTF-8', firstName='First', lastname='Last', languagelocalekey='en_US',
localesidkey='en_US', profileid = p.id,
timezonesidkey='Europe/London', username='Unit.Test@unittest.com');
insert u;
Certified Salesforce Technical Architect, Developer, Advanced Developer, Administrator, Advanced Administrator, Consultant, Sales Cloud Consultant,Service Cloud Consultant
Force.com MVP | The Bob Buzzard Blog | Linked In | Twitter
I don't respond to private messages/emails asking for help.
Take the Bob Buzzard Sobject Fields quiz.
Re: Compile Error: Field is not writeable: in User add method
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
02-05-2013 06:08 AM
I need to get values and to display in visual force page ,not inserting.
My requirement
selecting chatter group, then memberid i.e all member/user from that group based on that i need to display image
My exact error is , for loop return 2 values(member) , i need to store in for loop then it needs to be accessed in visual force page.
When i add to User standard object , it produce error
User.add(new user(FirstName='x.FirstName'))
I hope you may understand the problem
Re: Compile Error: Field is not writeable: in User add method
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
02-05-2013 06:34 AM
Why are you doing User.add? That would be trying to execute the add method of the user standard object 'class'.
Can you post the code that declares User?
Certified Salesforce Technical Architect, Developer, Advanced Developer, Administrator, Advanced Administrator, Consultant, Sales Cloud Consultant,Service Cloud Consultant
Force.com MVP | The Bob Buzzard Blog | Linked In | Twitter
I don't respond to private messages/emails asking for help.
Take the Bob Buzzard Sobject Fields quiz.

