+ Start a Discussion
miha198206miha198206 

Tags development

I've create code to add tags to contacts programmatically

 

                if (personalTagSelected != null)
                {
                    TagDefinition personalTag = [
                            SELECT Name
                            FROM TagDefinition
                            WHERE id = :personalTagSelected];
                    
                    ContactTag tag = new ContactTag(ItemId = id, Name = personalTag.Name, Type = 'Personal');
                    insert tag;
                }
                
                if (publicTagSelected != null)
                {
                    TagDefinition personalTag = [
                            SELECT Name
                            FROM TagDefinition
                            WHERE id = :publicTagSelected];
                    
                    ContactTag tag = new ContactTag(ItemId = id, Name = personalTag.Name, Type = 'Public');
                    insert tag;
                }
                
                string[] newPersonalTagsList = newPersonalTags.split(',');
                for (string newPersonalTag : newPersonalTagsList)   
                {
                    newPersonalTag = newPersonalTag.trim();
                    
                    ContactTag tag = new ContactTag(ItemId = id, Name = newPersonalTag, Type = 'Personal');
                    insert tag;
                }
                
                string[] newPublicTagsList = newPublicTags.split(',');
                for (string newPublicTag : newPublicTagsList)   
                {
                    newPublicTag = newPublicTag.trim();
                    
                    ContactTag tag = new ContactTag(ItemId = id, Name = newPublicTag, Type = 'Public');
                    insert tag;
                }

 

But I get an exception:


An internal server error has occurred An error has occurred while processing your request. The salesforce.com support team has been notified of the problem. If you believe you have additional information that may be of help in reproducing or correcting the error, please contact Salesforce Support. Please indicate the URL of the page you were requesting, any error id shown on this page as well as any other related information. We apologize for the inconvenience.

Thank you again for your patience and assistance. And thanks for using salesforce.com!

Error ID: 261134118-25955 (-1455206483)

 

How can I solve it?

imuino2imuino2

It sounds like a Salesforce problem, not in your code.

For what i read theres nothing wrong inyour code that could case an error.

You can put on contact with Salesforce support to se what they say

Try getting contact in here Support: https://login.salesforce.com/?ec=302&startURL=%2Fhelp%2Fdoc%2Fuser_ed.jsp

or in here http://www.salesforce.com/services-training/customer-support/

 

Ignacio.