• saasdev
  • NEWBIE
  • 25 Points
  • Member since 2008

  • Chatter
    Feed
  • 1
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 2
    Replies
I want to create a new trigger on a specified field(standard, custom).
 
When "status" field in Opportunity is changed or updated the trigger will be fired to modify some information in the correspongding account.
 
How can I deal with it? More tricky for me.
If trigger events can not be applied on the field objects, any other solutions will be appreciated. Thanks 

Hi All

 

I have creaed a visual force page that rerenders some images depending on what value is selected in a picklist - this works fine in Firefix, IE7, and most instances of IE 6, however, one version of IE (Explorer 6.02.2900.2180.spsp_sp2_gdr.080814.1233 (Version update SP2)), it does not seem to work in (which is handily, the one everyone uses, but not the one I developed on). The action support for the change in the picklist reruns the apex behind the page to generate the new image, and also rerender the ouput panel the image resides in. What I'm wondering is whether in this instance of IE, the rerender is happening before the apex updates the image url, thus it is not showing. Is there any way I can get to the javascript that is being run on the rerender so I can include a wait() function?

 

Page Code:

 

<td style="border-style:solid;border-width:0 2px 2px 0;vertical-align:top;width:50%;">
<apex:form style="{vertical-align:top}">
<div style="margin-left:100px">Please Select Date :</div>
<br/>
<apex:selectList value="{!AgentSalesDate}" multiselect="false" size="1" style="margin-left:100px">
<apex:selectOptions value="{!AgentSalesDateList}"> </apex:selectOptions>
<apex:actionSupport event="onchange" action="{!AgentSalesChange}" rerender="AgentSales"></apex:actionSupport>
</apex:selectList>
<br/>
<apex:outputPanel id="AgentSales">
<br/>
<img src="{!imageurl}"/>
</apex:outputPanel>
</apex:form>
</td>

 

 

Controller Code:

 

//function reruns the MainPageController to recalculate the image url
public void AgentSalesChange() {
MainPageController2();
}//end function

 

 

 

Thanks

Hi

I am trying to create a Trigger that runs when an object is updated, and then updates another record of the same object type. This leads to an infinite recursive loop, as the Trigger then runs on that update, and so on....

I've tried changing the trigger so when it first updates, it changes a criteria field, so second time round it should not execute the update line, but this doesn't appear to work.

I think there might be a way around it using classes, but don't have enough Apex knowledge to even take a stab at what that might be.

Any help much appreciated.

Thanks
I want to create a new trigger on a specified field(standard, custom).
 
When "status" field in Opportunity is changed or updated the trigger will be fired to modify some information in the correspongding account.
 
How can I deal with it? More tricky for me.
If trigger events can not be applied on the field objects, any other solutions will be appreciated. Thanks 
Here is the trigger...

Scroll down to ...// TRY DELETING CONTACTS
This works.
The next two lines try to delete Events.
These fail.
The account # came from Apex Explorer and I know is correct.
don't worry about all the 'weird' lines in this - it's just a copy and paste from the code window in SF.

***
*** I need to be able to delete events and recurring events given an Account ID. ***
***

trigger MakeRouteEvents on Account (before insert, before update)
{

// Trigger events
// before insert, before update, before delete, after insert
// after update, after delete, after undelete

// Trigger Context Variables
// isExecuting, isInsert, isUpdate, isUpdate, isDelete, isBefore
// isAfter, isUndelete, new, newMap, old, oldMap, size

Integer i;
Account[] oldRecords;
Account[] newRecords;
Lead newLead; // testing
Lead[] deleteLeads;
Event[] existingEvents;
String strAccountId;
Contact[] existingContacts;

if (Trigger.isInsert)
System.debug('An Insert Trigger');
else
System.debug('Not Insert Trigger');


strAccountId = '0017000000NB5vCAAT';

// this block works
//newLead = new Lead(lastname = 'FryZZ', company='FryZZ And Sons');
//insert newLead;

// this block works also
//deleteLeads = [select id, name from lead where company= 'Jackson Controls'];
//try
// {delete deleteLeads;}
//catch (DmlException e)
// {
// Process exception here
// }

// TRY DELETING CONTACTS
existingContacts = [select Id, AccountId from Contact where AccountId = '0017000000NB5vCAAT'];
delete existingContacts;

//existingEvents = [select Id, AccountId from Event where AccountId = :strAccountId];
existingEvents = [select Id, AccountId from Event where AccountId = '0017000000NB5vCAAT'];
delete existingEvents;





i=5;
//sqlContact = "select lastname from contact where accountid in";
//resultContact = [ :Trigger.new];

//CustomerRouting.DropCustomerRouteEvents();


oldRecords = Trigger.old;
newRecords= Trigger.new;

System.debug(oldRecords[0].Number_of_Units__c);
System.debug(newRecords[0].Number_of_Units__c);

}