function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Btuitasi1Btuitasi1 

Idea Zone API Name

Hey guys,
I am writing a trigger to create a new record in Idea from an existing record in one of our custom objects. Here is my code:

trigger backToIdea on Idea_Lobby__c (after update) {
for (Idea_Lobby__c yourIdea : Trigger.new) {

if (yourIdea.Approval__c == 'Approved')
{
        Idea backAgain      = new Idea();
        backAgain.Name__c   = yourIdea.Name__c;
        backAgain.Location__c = yourIdea.Location__c;
        backAgain.Company__c = yourIdea.Company__c;
        backAgain.Title = yourIdea.Name;
        backAgain.Body = yourIdea.Idea_Body__c;
        insert backAgain;
}
else if(yourIdea.Approval__c == 'Delete')
{
  Idea_Lobby__c y = new Idea_Lobby__c();
        y.Id = yourIdea.Id;
        delete y;
        }
}
}


Since Zone is a required field, I get an error when the trigger fires. Does anyone know the API name for Zone in the Idea object, so I can set it when the new record is created?

Thanks!
Best Answer chosen by Btuitasi1
SonamSonam (Salesforce Developers) 
I suppose its the communityID which represents the Zone of the IDEA, as I understand from the follwoing docs:
https://www.salesforce.com/us/developer/docs/api/Content/sforce_api_objects_community.htm
http://www.salesforce.com/us/developer/docs/officetoolkit/Content/sforce_api_objects_community.htm

All Answers

SonamSonam (Salesforce Developers) 
I suppose its the communityID which represents the Zone of the IDEA, as I understand from the follwoing docs:
https://www.salesforce.com/us/developer/docs/api/Content/sforce_api_objects_community.htm
http://www.salesforce.com/us/developer/docs/officetoolkit/Content/sforce_api_objects_community.htm

This was selected as the best answer
Btuitasi1Btuitasi1
Thanks! I figured it out. I went to the record profile of my internal zone and found the ID there. I then mapped that ID in my trigger.