• minku1986
  • NEWBIE
  • 0 Points
  • Member since 2010

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 3
    Replies

I have to populate a user lookup field in an object through apex. What value of the user object do I need to assign it such that it gets the user in the lookup feel automatically?

 

I am assigning the OwnerId field. Is that correct?

Message Edited by minku1986 on 03-03-2010 06:51 PM

I am trying to add some data to a field.

 

But it gives me this error...

 

Apex trigger handleProjectManagerLookup caused an unexpected exception, contact your administrator: handleProjectManagerLookup: execution of AfterUpdate caused by: System.Exception: Record is read-only: Trigger.handleProjectManagerLookup: line 7, column 6

 

What should I do
Message Edited by minku1986 on 03-03-2010 06:53 PM

I have a field named Total Students... and trying to do a count() on the object but can not get it to work...

It keeps bringing up this error:

Error: Invalid Data.
Review all error messages below to correct your data.
Apex trigger TTLs caused an unexpected exception, contact your administrator: TTLs: execution of AfterUpdate caused by: System.Exception: Record is read-only: Trigger.TTLs: line 7, column 9

 

trigger TTLs on Account (after update) { List<Account> udte = new List<Account>(); Integer accs; accs=[Select count() from Account where RecordType.Name='Student']; for(Account hr: trigger.old) { hr.Total_Students__c=accs; htoUpdte.add(hr); } }

 Yes I check the field level security, everything is editable about this field...

Where am I going wrong...