+ Start a Discussion

Locking Idea after time span

Hey guys,

I have created a workflow that changes a field in Ideas from "Open" to "Locked" after 30 days. Now, I would like to create a trigger that would actually lock the record making it read-only. How would I call the record type in my trigger? Here is my code so far:

Trigger IdeaRecordLock on Idea (after update, after insert) {
  for (Idea a : Trigger.New) {
    if (a.Voting_Status__c == 'Locked') {
   // the remaining code would go in and change the record to read-only. Admins and standard users would be the only ones able to edit.

Any ideas?

Thanks guys!
Thanks for the reply, but that post was from 7 years ago. I sure there is a way to do this in apex since IsLocked is an API name for Ideas.