• Frenchy52
  • NEWBIE
  • 0 Points
  • Member since 2009

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 3
    Replies

I have 3 objects: Transaction Rel, Transaction and Target Client Relationship. Transaction Rel is attached as a related list to Transaction and Target Client is a lookup on Transaction Rel. Everything starts at the Traget Client Relationship level. I built some code on the Target Client Relationship object that works through  a button when I click this button I want the system to create a basic Transcation record and Transaction Rel records and attach the transaction Rel record to the Target Client Record it originates from. THis thing works beautifully in Sandabox and does exactly what I want it to do. I built the test methods and they all validate at more than 75%.  I transfered all this in Production and I now get this error message when I try to create  a Transaction or a Transaction relationship or when I when I click on the button:

 

CreateTransactionRel: maximum trigger depth exceeded Target_Client_Relationship trigger event AfterUpdate for [a067000000WCGoM] Transaction trigger event AfterInsert for [a087000000JnL27] Transaction_Relationship trigger event AfterInsert for [a0E70000008CS6R] Target_Client_Relationship trigger event AfterUpdate for [a067000000WCGoM] Transaction trigger event AfterInsert for [a087000000JnLZ9] Transaction_Relationship trigger event AfterInsert for [a0E70000008CS6S] Target_Client_Relationship trigger event AfterUpdate for [a067000000WCGoM] Transaction trigger event AfterInsert for [a087000000JnLZA] Transaction_Relationship trigger event AfterInsert for [a0E70000008CS6T] Target_Client_Relationship trigger event AfterUpdate for [a067000000WCGoM] Transaction trigger event AfterInsert for [a087000000JnLZB] Transaction_Relationship trigger event AfterInsert for [a0E70000008CSeV] Target_Client_Relationship trigger event AfterUpdate for [a067000000WCGoM] Transaction trigger event AfterInsert for [a087000000JnLZC] Transaction_Relationship trigger event AfterInsert for [a0E70000008CSeW] Target_Client_Relationship trigger event AfterUpdate for [a067000000WCGoM]

 

 

To achieve this I have 3 steps:

 

1-I created a button with  a link that triggers the first trigger

 

2-Trigger on the Target Client Relationship record:

 

 

trigger CreateTransaction on Target_Client_Relationship__c (after insert, after update) {

    
    List <Transaction__c> tranToInsert = new List <Transaction__c> ();  
    
    
    for (Target_Client_Relationship__c o : Trigger.new) {
        
        
       
        if (o.Type__c =='YES') {  
        
        Transaction__c v = new Transaction__c ();
        
        
        v.target__c = o.Target__c;
       
        v.Transaction_Headline__c = o.Target_Name__c+ ' received an investment by '

+o.Related_Company_Name__c ;
        
        v.Transaction_Press_Release_Text__c = 'No further information is available on this investment.  

Please feel free to submit additional information on this transaction using the "Suggest Transaction

Update" button above.';
        
        v.TCRID__c= o.TCRID__c;
        
        v.RelatedCoID__c= o.Related_Company_ID__c;
        
        v.Trigger__c= o.Type__c;
        
        v.Record_Status__c='New';
        
        v.Transaction_Status__c='Closed';
        
        v.No_PR__c=true;
        
        tranToInsert.add(v);
        
        
        }
        
    }
   

 

 

 

 

 

3- Trigger on the Transaction record that creates the Transcation Rel

 

 

trigger CreateTransactionRel on Transaction__c (after insert) {

    
    List <Transaction_Relationship__c> TRToInsert = new List <Transaction_Relationship__c> ();  
    
    
    for (Transaction__c o : Trigger.new) {
        
        
       
        if (o.Trigger__c =='YES') {  
        
        Transaction_Relationship__c v = new Transaction_Relationship__c (); 
        
        v.Transaction__c = o.TransID__c;
        
        v.target__c = o.Target__c;
       
        v.Name = o.Target_Name__c+' Financing'; 
        
        v.Target_Relationship__c = o.TCRID__c;
        
        v.Related_Company__c = o.RelatedCoID__c;
           
        
        TRToInsert.add(v);
        
        
        }
        
    }

 

 

Why is this code working in Sandbox and not in Production?

I have a master record where i am pulling  in one field the name of the related accounts that sit on a related object.

The following code works to pull one fields from the related objects but when I try to querry on 3 fields the code does not work anymore.

 

Code that works:

 

result1 = sforce.connection.query("Select Related_Company_Name__c from Transaction_Relationship__c where Type__c='Buyer / Investor' and Transaction__c='"+tarx.Id+"'"); var rSize = result1.size; var NewValue =""; var longName = " "; if(rSize>1){ var i = 0; for (i = 0 ; i<rSize;i++){ longName=longName + "; "+result1.records[i].Related_Company_Name__c ; } var NameLength = longName.length; longName = longName.substring(3,NameLength); } if(rSize == 1){ longName=" "+result1.records.Related_Company_Name__c; }


Here is the code that does not work:

 

result1 = sforce.connection.query("Select Related_Company_Name__c from Transaction_Relationship__c where Type__c='Buyer / Investor' and Transaction__c='"+tarx.Id+"'"); result2 = sforce.connection.queryMore("Select Related_Company_Prime__c from Transaction_Relationship__c where Type__c='Buyer / Investor' and Transaction__c='"+tarx.Id+"'"); var rSize = result1.size; var NewValue =""; var longName = " "; if(rSize>1){ var i = 0; for (i = 0 ; i<rSize;i++){ longName=longName + "; "+result1.records[i].Related_Company_Name__c+result2.records[i].Related_Company_Prime__c ; } var NameLength = longName.length; longName = longName.substring(3,NameLength); } if(rSize == 1){ longName=" "+result1.records.Related_Company_Name__c+result2.records[i].Related_Company_Prime__c; }

 


Message Edited by Frenchy52 on 07-14-2009 03:31 PM
Message Edited by Frenchy52 on 07-15-2009 10:20 AM

I'm trying to modify my Account view from displaying related lists to a tabbed interface.  I have done this successfully with standard objects, but I get an error when I try to append a Custom Object related list.

 

 <apex:tab label="Expenses" name="Expenses" id="tabExp">
         <apex:relatedList subject="{!account}" list="Expenses" />
 </apex:tab>

 

I have a Custom Object "Expense" with a master-detail relationship to Accounts.  I use the proper child relationship name but I get an error stating "Expenses" is not a valid child relationship to the Account entity.

 

Any thoughts? Thanks!

  • March 20, 2009
  • Like
  • 0

I created tabs following the Tabbed Accounts in 30 seconds post and my problem is that whenever I perform an action on any tab other than the detail tab I'm returned to the detail tab after the action is completed instead of returning to the tab I was on.  

 

I tried to find code samples that my lead me to an answer and I thought maybe I had to create an standard controller extension which I attached below.  However, I'm very green at this so I don't really know how to continue so any direction and sample code would be greatly appreciated.  I'm sure I'm not the only one who has implemented this cool technique and has run into this problem.

 

Keith

 

VS Page:

 

<apex:page standardController="Account" extensions="accountExt" id="p"
showHeader="true" tabStyle="account" >
<apex:tabPanel switchType="client" selectedTab="name2" id="theTabPanel">
<apex:tab label="Details" name="AccDetails" id="tabdetails">
<apex:detail relatedList="false" title="true"/>
</apex:tab>
<apex:tab label="Contacts" name="Contacts__r" id="tabContact">
<apex:relatedList subject="{!account}" list="contacts__r" />
</apex:tab>
<apex:tab label="Invoices" name="Invoices" id="tabInvoice">
<apex:relatedList subject="{!account}" list="invoices__r" />
</apex:tab>
<apex:tab label="Open Activities" name="OpenActivities" id="tabOpenAct">
<apex:relatedList subject="{!account}" list="OpenActivities" />
</apex:tab>
<apex:tab label="Products Offered" name="ProductsOffered" id="tabProdOffer">
<apex:relatedList subject="{!account}" list="Products_Offered__r" />
</apex:tab>
<apex:tab label="Products Sold" name="ProductsSold" id="tabProdSold">
<apex:relatedList subject="{!account}" list="Product_Releases__r" />
</apex:tab>
</apex:tabPanel>
</apex:page>

 Controller:

 

public class accountExt {

String aId;
String pId;

public accountExt(ApexPages.StandardController controller) {
aId = ApexPages.currentPage().getParameters().get('aId');
pId = ApexPages.currentPage().getParameters().get('pId');
}

public PageReference redirect(){
PageReference pageRef = new PageReference('/'+pId);
pageRef.setRedirect(true);
return pageRef;
}

public void setState(String n) {
state = n;
}

public String getState() {
return state;
}

public PageReference methodOne() {
return null;
}

private String state = 'no';
}