You need to sign in to do that
Don't have an account?
carramrod81
Cannot deploy trigger to server with Eclipse
Hi,
I've created a trigger, and be it with my dev account or my production account, when i try and deploy with Eclipse, i get "Cannot deploy to project's organization" on the first page of the deploy wizard. I know my trigger works, as i've uploaded it and made it active on my development account, but obviously that isn't possible on production. This was modified from one of the cookbook examples on lead deduplication.
Please help:
trigger trDuplicatePreviousUserCodeCheck on Previous_User_Code__c (before insert, before update) {
Map<String, Previous_User_Code__c> ucMap = new Map<String, Previous_User_Code__c>();
for(Previous_User_Code__c puc : System.Trigger.new) {
if((puc.Name != null) && (System.Trigger.isInsert ||
(puc.Name != System.Trigger.oldMap.get(puc.ID).Name))) {
if(ucMap.containsKey(puc.Name)){
puc.Name.addError('Another Account has this same previous user code');
} else {
ucMap.put(puc.Name, puc);
}
}
}
for(Previous_User_Code__c puc : [SELECT Name FROM Previous_User_Code__c
WHERE Name IN : ucMap.Keyset()]) {
Previous_User_Code__c newPuc = ucMap.get(puc.Name);
newPuc.Name.addError('This user code already exists.');
}
}
i did read that i need some sort of test class, so i tried to create one but am still getting the same results. I created the class and did Force.com -> Run Tests and it does it's thing, but when i try and go back to the trigger to deploy, i get nothin. Am i doing all this correctly?
public class DuplicatePreviousUserCodeCheckTests {
static testMethod void testUserCodeDupePreventer()
{
Set<String> testUserCodes = new Set<String>;
testUserCodes.add('1');
testUserCodes.add('2');
testUserCodes.add('3');
System.assert([SELECT count() FROM Previous_User_Code__c
WHERE Name IN: testUserCodes] == 0)
Previous_User_Code__c code1 = new Previous_User_Code__c(Name='1',Account=0014000000Hb89g,
Previous_User_Code='1');
insert Previous_User_Code__c
}
}
Message Edited by carramrod81 on 05-27-2008 09:23 AM
I've created a trigger, and be it with my dev account or my production account, when i try and deploy with Eclipse, i get "Cannot deploy to project's organization" on the first page of the deploy wizard. I know my trigger works, as i've uploaded it and made it active on my development account, but obviously that isn't possible on production. This was modified from one of the cookbook examples on lead deduplication.
Please help:
trigger trDuplicatePreviousUserCodeCheck on Previous_User_Code__c (before insert, before update) {
Map<String, Previous_User_Code__c> ucMap = new Map<String, Previous_User_Code__c>();
for(Previous_User_Code__c puc : System.Trigger.new) {
if((puc.Name != null) && (System.Trigger.isInsert ||
(puc.Name != System.Trigger.oldMap.get(puc.ID).Name))) {
if(ucMap.containsKey(puc.Name)){
puc.Name.addError('Another Account has this same previous user code');
} else {
ucMap.put(puc.Name, puc);
}
}
}
for(Previous_User_Code__c puc : [SELECT Name FROM Previous_User_Code__c
WHERE Name IN : ucMap.Keyset()]) {
Previous_User_Code__c newPuc = ucMap.get(puc.Name);
newPuc.Name.addError('This user code already exists.');
}
}
i did read that i need some sort of test class, so i tried to create one but am still getting the same results. I created the class and did Force.com -> Run Tests and it does it's thing, but when i try and go back to the trigger to deploy, i get nothin. Am i doing all this correctly?
public class DuplicatePreviousUserCodeCheckTests {
static testMethod void testUserCodeDupePreventer()
{
Set<String> testUserCodes = new Set<String>;
testUserCodes.add('1');
testUserCodes.add('2');
testUserCodes.add('3');
System.assert([SELECT count() FROM Previous_User_Code__c
WHERE Name IN: testUserCodes] == 0)
Previous_User_Code__c code1 = new Previous_User_Code__c(Name='1',Account=0014000000Hb89g,
Previous_User_Code='1');
insert Previous_User_Code__c
}
}
Message Edited by carramrod81 on 05-27-2008 09:23 AM
What you need to do is this:
DO NOT connect an eclipse project with your production account.
I connected my dev account only. After i had all my testMethods covering 75%+ of my code, i then hit "Deploy to server". At this point, enter your credentials for your production account, and go through the deployment plan.
if you have an eclipse project connected with your production environment, i'd delete it. Only create a project with your dev environment.