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
sales4cesales4ce 

Deploy a Trigger to production

Hi,

 

I have a trigger to be deployed to production.

The trigger assigns some Leads after a Business criteria to a Queue.

 

I have created that queue in sandbox and when i try to deploy the trigger through the Force.com IDE, it is raising an error in deployment plan, saying reference ID not valid.

 

since that queue ID is used in trigger, i guess i need to move the queue first to production which would have same ID.

 

So how do i first move my queue to production?

 

Any help on this is highly appreciated.

 

Thanks,

Sales4ce

ShamSham

Hi,

The queue could have a different ID when u manually create the Queue in production.

The best course according to me would be query the queue Id on basis of its name

 

eg

[select Id from Group where Name = 'queuename' and Type= 'Queue']

 

This would work both in sandbox and production

 

sales4cesales4ce

Sham,

 

Thanks for reply!

But i need to assign Leads to that queue. To assign Leads to that queue i need to pass the ID over the name of queue.

I am guessing that we need to first sync created queue in sandbox with production and then move trigger to production.

I am not quite sure how i can do that. Any suggestions?

 

Thanks,

sales4ce

BylithiumBylithium

its better you create the queue and move the trigger.

Thts how i do..

sales4cesales4ce

How do i move the queue?.

 

JonPJonP

Sham's advice was correct.  The query he supplied searches for the queue by name and returns the Id at runtime.  Once your trigger executes this query and obtains the Id value, you can use it in place of the hard-coded Id string you're using today, including to assign leads.

 

You should never hard-code an Id value in your Apex code.  Any time you do that in development, you're setting yourself up to not be able to deploy to production later.

 

Jon

salesforce.com Product Manager