+ Start a Discussion
PProkesPProkes 

Editing Triggers

Our company has created a "Custom Object" called "Facility Limit". It was created by our US parent in 2008. Now that our company has been bought out, I am the sole administrator in Australia and need to edit the "Facility Limit" object. I can't seem to edit the Custom Field names nor the Triggers coding, as it comes up with an error message stating that the field or trigger is linked to something else. I'm confused then how to make the necessary changes because I have to start somewhere. Any ideas?

b-Forceb-Force

We can not edit triggers in production environment directly  :)

 

In order to do changes you need to create a Sandbox (Development environment ) for your organization

Steps to create  Sandbox

Setup==> Administrative setup==>Datamanagement ==> Sandbox

 

Create New

Select full

Save it

Schedule the sandbox refresh

 

Now your development environment is ready

 

Do any trigger code changes in Sandbox

 

after testing Deploy this changes to production by using Changesets /eclipse

 

Hope this will help you,

 

Please let me know if you need any more help , just drop me a mail

 

Thanks,

Bala

 

 

 

PProkesPProkes

Thank you for your response. I have tried making the Trigger changes in UAT though actually received the error messages from UAT. So I'm not sure where I begin making changes without the error messages appearing, as I get message when I try editing the field name, and when I try to edit the trigger.

 

I believe we already had a test environment setup for us (by our external SFDC consultants), though it seems I cannot select the "Full" Type, as the default is "Developer" and I cannot change it (the other 2 options - "Full" and "Configuration Only" are greyed out).

 

 

b-Forceb-Force

Even you can use existing test sandbox,

Just refresh it and start using ...after all your admin.

 

If this is not possible you can create developer sandbox [For this you need to create manually :) ]

 

**** If you try to change custom fields in Custom objects , It will throw error because this fields are refered by triggers

 

The easiast way to find references as follow:

 

Create new project in eclipse extract all metadata ,

Find all refernces using search utility

Comment this changes [Be careful we are going to rollback this changes ]

Save changes to server  [test sandbox] ,

Do your field changes

Rollback above changes ,[Use newlly created fields and objects if any ]

save to server 

test it

 

****** Do same execrcise while deploying changes in production

 

check this post this person was having same issue

 

 

I know this is heavy stuff .... but there is no any other way ....:(

 

Hope this will help you,else let me know .

 

 

Thanks,

Bala

 

 

Save to servere

 

PProkesPProkes

Hi, please review the trigger below and let me know why the lines beginning with "totalWon" and "totalOpen" (near the bottom) need to be edited before the trigger can be saved.

 

The requirement is to have the "Dell_Limit_Settled_c" field on the "Master_Lease_Agreement_c" (MLA) custom object page equal the sum of the "Dell Amount" field on the Opportunity page for opportunities that are "WON" and linked to that MLA.

 

The trigger details are:

 

trigger mlaCalculateDellLineOfCreditUsed on Master_Lease_Agreement__c (before update) {

 

if (OppUtilities.isOppTrigger == false) {   
if (Trigger.isUpdate) {           

 

List<Id> mlaIds = new List<Id>();         

 

for (Master_Lease_Agreement__c record : Trigger.new) {        
if (!(Trigger.oldMap.get(record.Id).Dell_Limit_Settled__c == Trigger.newMap.get(record.Id).Dell_Limit_Settled__c             && Trigger.oldMap.get(record.Id).Dell_Limit_in_Pipeline__c == Trigger.newMap.get(record.Id).Dell_Limit_in_Pipeline__c)) {         

mlaIds.add(record.Id);       
}     
}           

 

if (mlaIds.size() > 0) {       
Map<Id, Decimal> totalWonDellAmountMap = new Map<Id, Decimal>();       
Map<Id, Decimal> totalOpenDellAmountMap = new Map<Id, Decimal>();               

 

OppUtilities oppUtil = new OppUtilities();               

 

totalWonDellAmountMap = oppUtil.getTotalOpportunityDell_Amount_cByMLAIds(mlaIds, OppUtilities.ForecastType.WON);       
totalOpenDellAmountMap = oppUtil.getTotalOpportunityDell_Amount_cByMLAIds(mlaIds, OppUtilities.ForecastType.OPEN);             

 

for (Id mlaId : mlaIds) {         
//Update the Master_Lease_Agreement__c record's Dell_Limit_Settled__c and Dell_Limit_in_Pipeline__c fields         
Trigger.newMap.get(mlaId).Dell_Limit_Settled__c = totalWonDellAmountMap.get(mlaId);         
Trigger.newMap.get(mlaId).Dell_Limit_in_Pipeline__c = totalOpenDellAmountMap.get(mlaId);         
}     
}         

 


}

 

}

PProkesPProkes

Note that the API Name for the "Dell Amount" field is "Dell_Amount__c".