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

Save error: Unable to perform save on all files



I'm trying to create a simple trigger that will add a hyphen to a custom field. I am using the following code for the trigger:


trigger MyTrigger on My_Object__c (before insert, before update) {
for (Integer i=0;i<;i++) {
String tmp =[i].My_Field__c;
if ((tmp != null) && (tmp.length() == 9)) {
tmp = tmp.substring(0,3)+'-'+tmp.substring(3,5);[i].My_Field__c = tmp;


And I have the following test case, which runs fine with 0 lines not tested, 100% covered:


public with sharing class TestCase {
public static testMethod void testMyTrigger() {
My_Object__c someObject = new My_Object__c();
someObject.Name = 'testing';
insert someObject;
someObject.My_Field__c = '12345';
update someObject;

My_Object__c out = [select My_Field__c from My_Object__c where Id = :someObject.Id];
System.assertEquals('123-45', out.My_Field__c);


And when I try to save in Eclipse 3.4.2 with Salesforce plugin version I get the "Unable to perform save on all files" error. If I comment out the line in the trigger with the substring(), it saves fine. If I uncomment it, I get the error again. What is going on?

Message Edited by Nyssa on 03-09-2010 10:45 PM
Hmm its weird , it should works. what is the data type of My_Type__c ?

Are you saving this to a Production instance or are you on a Sandbox?  (sounds like Production instance) 

Thanks for the response. The data type of My_Field__c is Text(80). This is on a Production instance.

When deploying code to a Production instance and I get that error, it usually means there is some issue with the deployment.


Because the IDE often doesn't give much information, I use the Migration Tool to deploy complex code (triggers/classes).


Using the Migration tool will give you the system log, allowing you to see what the exact error message is, which file it occurred on, and which line number it was initiated by.


Debugging without knowing that information is really tough and stressful!


So please have a look at the Migration Tool, there's some setup involved, but overall, it will save you some headaches in the future.