• Joel Richards
  • NEWBIE
  • 10 Points
  • Member since 2013
  • Senior Salesforce Administrator & Developer
  • Data#3

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 3
    Questions
  • 5
    Replies
Hi,
I have a Connected Canvas App that uses a Lifecycle Class - both are part of a managed package. In the OAuth policies I've set the Permitted Users to 'Admin approved users are pre-authorized' and included all the Profiles I require to have access. In those Profiles I've also ticked the App in the Connected App Access section. FYI, the Lifecycle Class doesn't allow profiles security to be set as per other 'normal' apex classes.

When my users who should have access to this App try and run it, the are given the error: 'Oops, there was an error [rendering Force.com Canvas application [App Name]. You don't have permissions to invoke Canvas lifecycle handler (apex class) [Class Name].'

It works for all System Admins and if I give any of these other users System Admin access (temporarily) it will work for them too.

I have the same setup in a different sandbox and it is working just fine.

Has anyone had any similar issues with access tot the Canvas Lifecycle handler class and know what may be wrong?
Hi, I'm trying to Enable Filter-Based Opportunity Territory Assignment for Enterprise Territory Management.Part of the setup is:
'If your organization is using the Apex code Salesforce provides, first create the class and then return to this Settings page and enter the class name: OppTerrAssignDefaultLogicFilter. If you opt to use your own code for the Apex class, you’ll come back and enter the name of the class that you create.

However I can't find any other information related to the 'OppTerrAssignDefaultLogicFilter' class anywhere. Has anyone come across this apex class and if so can they share it?

Hi I have developed a visualforce page with a controller extension. That should allow the user to select a custom Object 'Territory_Account__c' for deletion (among other things) the problem is that the selected Territory Account is not returning True. The controller and visualforce page code is below. Any help would be great!

 

Page Controller:

public with Sharing class TerritoryController{
	
    ApexPages.StandardController con;
    public Territory__c Territory {get; set;}
    public List<TAWrapper> TAccounts {get;set;}
    private List<Territory_Account__c> TADeleteList = New List<Territory_Account__c>();
    private integer counter=0;  //keeps track of the offset
    public integer list_size=200; //sets the page size or number of rows
   	public integer total_size; //used to show user the total size of the list
    boolean DTA = False;
    Public Id TerritoryId;
    
    public TerritoryController(ApexPages.StandardController TController) {
    
      //  con = TController;
     //   Territory = (Territory__c)TController.getRecord();
        TerritoryId = ApexPages.CurrentPage().getParameters().get('id');
        
        total_size = [SELECT count() FROM Territory_Account__c WHERE Territory__c = :TerritoryId];
    }
    
    Public List<TAwrapper> getTAs() {	
        System.Debug('Joel: GetTAs has run');
        If(TAccounts == NULL) {
        	TAccounts = New List<TAWrapper>();
            For(Territory_Account__c TerAcc : [SELECT Id, Account__c, Account__r.name, Liberate_Cust_ID__c, Debtor_Group__c 
                                                   FROM Territory_Account__c 
                                                   WHERE Territory__c = :TerritoryId
                                                   ORDER BY Account__r.name
                                               	   LIMIT :list_size
                                                   OFFSET :counter])
                TAccounts.add(new TAWrapper(TerAcc,False));  
        } 
        return TAccounts;
    }
    

    Public class TAwrapper {

        Public TAwrapper(Territory_Account__c rTA, Boolean rSelected) {
            Selected = rSelected;
            TAccount = rTA;
        } 
        
        public Boolean Selected {get; set;}
        public Territory_Account__c TAccount {get; set;}
    }

    public PageReference DeleteTA() { 

        TADeleteList = New List<Territory_Account__c>();
        List<Id> TAIdList = New List<Id>();
        Territory_Account__c TAd;
	//	DTA = True;
        
    	For(TAWrapper TW : getTAs()) {
				System.debug('Joel: Print of TW '+TW);
                If(TW.Selected == True) {
                    System.Debug('Joel: TA is Selected');
                    TAIdList.Add(TW.TAccount.Id);
                }
            }
        
        If(TAIdList.Size()>0) { 
            For(Territory_Account__c Tac : [Select Id from Territory_Account__c where Id IN :TAIdList])
            	TADeleteList.Add(Tac);
            Delete TADeleteList;
            DTA = False;
         //   TAccounts = NULL;
            return NULL; //new PageReference(ApexPages.currentPage().getUrl());
        }
        else {
            System.Debug('Joel: TAdelete list is empty');
            ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.INFO,'No Territory Accounts Selected'));
            DTA = False;
            Return Null;
        }       
              
      	
   	}

 The Visualforce Page:

<apex:page standardController="Territory__c" extensions="TerritoryController">
    <apex:sectionHeader title="Territory" subtitle="{!Territory__c.Name}"/>
    <apex:pageMessages />
    <apex:detail subject="{!$CurrentPage.parameters.id}" relatedList="false" title="false"/> 
    
    <apex:includeScript value="https://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.js"/>
    <script type="text/javascript">
        jQuery.noConflict();        
        $j = jQuery;
        
        $j( function(){
            $j("input.SelectAll").click(function(event){                
                $j("table.AccountsTable input[type=checkbox]").attr("checked", event.target.checked);
            });
        
        });        
    </script>
     
    <apex:pageBlock Title="Territory Accounts">
		<apex:pageBlockButtons location="top" >
   			<apex:outputPanel id="myButtons">
                <apex:form >
                    <apex:commandButton action="{!NewTA}" title="New Territory Account" value="New Territory Account" style="font-size:x-small;"/>
                    <apex:commandButton action="{!DeleteTA}" title="Delete Territory Account" value="Delete Territory Account" style="font-size:x-small;"/><br/>
                 <!--   <apex:commandButton action="{!Beginning}" title="Beginning" value="First Page" disabled="{!disablePrevious}" reRender="myPanel,myButtons" style="font-size:xx-small;"/>
                    <apex:commandButton action="{!Previous}" title="Previous" value="Previous Page" disabled="{!disablePrevious}" reRender="myPanel,myButtons" style="font-size:xx-small;"/>        
                    <apex:commandButton action="{!Next}" title="Next" value="Next Page" disabled="{!disableNext}" reRender="myPanel,myButtons" style="font-size:xx-small;"/>
                    <apex:commandButton action="{!End}" title="End" value="Last Page" disabled="{!disableNext}" reRender="myPanel,myButtons" style="font-size:xx-small;"/>   -->
               </apex:form>
       		</apex:outputPanel>
   		</apex:pageBlockButtons>
        
        <apex:outputPanel id="myPanel">
            <apex:form >
                <apex:outputPanel rendered="{!total_size > list_size}" style="color:red;">
                    <apex:outputText value="{0,number,###0}"><apex:param value="{!total_size}" /></apex:outputText>
                    results found,&nbsp;  
                    <apex:outputText value="{0,number,###0}"><apex:param value="{!list_size}" /></apex:outputText>
                    displayed per page<br/> 
                </apex:outputPanel>
                <apex:outputPanel rendered="{!total_size>list_size}">
                    Go to page: &nbsp;&nbsp;
                    <apex:commandLink action="{!page1}" value="1" rendered="{!AND(counter!=0,total_size>list_size)}" rerender="myPanel,myButtons"/>
                    <apex:outputText value="1" rendered="{!AND(counter==0,total_size>list_size)}" style="color:#666666;"/>
                    &nbsp;&nbsp;
                    <apex:commandLink action="{!page2}" value="2" rendered="{!AND(OR(counter<list_size,counter>=(list_size*2)),total_size>(list_size))}" rerender="myPanel,myButtons"/>
                    <apex:outputText value="2" rendered="{!AND(counter>=list_size,counter<(list_size*2),total_size>(list_size))}" style="color:#666666;"/>
                    &nbsp;&nbsp;
                    <apex:commandLink action="{!page3}" value="3" rendered="{!AND(counter<(list_size*2),total_size>(list_size*2))}" rerender="myPanel,myButtons"/>
                    <apex:outputText value="3" rendered="{!AND(counter>=(list_size*2),counter<(list_size*3),total_size>(list_size*2))}" style="color:#666666;"/>
                    &nbsp;&nbsp;
                    <apex:commandLink action="{!page4}" value="4" rendered="{!AND(counter<(list_size*3),total_size>(list_size*3))}" rerender="myPanel,myButtons"/>
                    <apex:outputText value="4" rendered="{!AND(counter>=(list_size*3),counter<(list_size*4),total_size>(list_size*3))}" style="color:#666666;"/>
                    &nbsp;&nbsp;
                    <apex:commandLink action="{!page5}" value="5" rendered="{!AND(counter<(list_size*4),total_size>(list_size*4))}" rerender="myPanel,myButtons"/>
                    <apex:outputText value="5" rendered="{!AND(counter>=(list_size*4),counter<(list_size*5),total_size>(list_size*4))}" style="color:#666666;"/>
                </apex:outputPanel>
    	
            	<apex:pageblockTable styleClass="AccountsTable" id="accounts-table" value="{!TAs}" var="TA" >
            		<apex:column style="width:60px;">
                  		<apex:facet name="header">
                    		<input type="checkbox" class="SelectAll"/>Action                  
                  		</apex:facet>            
                        <apex:inputCheckbox value="{!TA.Selected}"/>   
            		</apex:column>
                    <apex:column value="{!TA.TAccount.Account__c}" />
                    <apex:column value="{!TA.TAccount.Liberate_Cust_ID__c}"/>
                    <apex:column value="{!TA.TAccount.Debtor_Group__c}"/>
    			</apex:pageblockTable>
            </apex:form>
        </apex:outputPanel>
    </apex:pageBlock>
</apex:page>

 

Hi,
I have a Connected Canvas App that uses a Lifecycle Class - both are part of a managed package. In the OAuth policies I've set the Permitted Users to 'Admin approved users are pre-authorized' and included all the Profiles I require to have access. In those Profiles I've also ticked the App in the Connected App Access section. FYI, the Lifecycle Class doesn't allow profiles security to be set as per other 'normal' apex classes.

When my users who should have access to this App try and run it, the are given the error: 'Oops, there was an error [rendering Force.com Canvas application [App Name]. You don't have permissions to invoke Canvas lifecycle handler (apex class) [Class Name].'

It works for all System Admins and if I give any of these other users System Admin access (temporarily) it will work for them too.

I have the same setup in a different sandbox and it is working just fine.

Has anyone had any similar issues with access tot the Canvas Lifecycle handler class and know what may be wrong?
trigger populateRivals on account(before insert,before update)
{    
  list<Rival__c> rvl = [select id,Name__c from rival__c ];
  map<string,id> rvlMap = new map<string,id>();
  for(Rival__c r:rvl)
  if(rvl!=null && rvl.size()>0)
  {
      {
          rvlMap.put(r.Name__c,r.id);
      }
  }      
 for(account acc: trigger.new)
 {  if(rvlMap!=null&&rvlMap.containsKey(acc.Rival_Picklist__c))
   {
     acc.Rival__c = rvlMap.get(acc.Rival_Picklist__c);
   }
  }  
}
here is the test class
@isTest
 public class TestpopulateRivals{
 public static testmethod void testpopulaterivals()
 {
     
     
     Rival__c rc = new Rival__c(Name ='Chitral');
     insert rc;
     
     account ac = new account(Name = 'Chitral Chadda');
     ac.Rival_Picklist__c = 'Chitral';
     
     insert ac;
     
    List<Account> acct =[Select id, Rival__c,Rival_Picklist__c FROM Account WHERE Rival__c =: rc.id];
     system.assertEquals(rc.id,acct[0].Rival__c);
    
  }
 }

i get error: System.ListException: List index out of bounds: 0
any idea?
I have been working on building a trigger that would allow my users to use a single Intake Form which would then change the record type based on the values they provide on the Intake Form page layout. Basically, people can come in and make selections based on their circumstances. Those selections will determine which type of record type the record should be. Below is the code that I have been working on that does not seem to be working.
trigger IntakeFormTrigger on Apttus__APTS_Agreement__c (after insert, before update) {
 
    // Get a list of record types.
    Map<ID,RecordType> typeMap = New Map<ID,RecordType>([Select ID, DeveloperName From RecordType Where sObjectType = 'Apttus__APTS_Agreement__c']);
  
    for (Apttus__APTS_Agreement__c agmt : trigger.new)
    {
        // If the Record Type = Intake Form
        if (agmt.RecordType.DeveloperName == 'Intake Form')
        {
            // And the Agreement Category on the record =TEST
                if (agmt.Apttus__Agreement_Category__c == 'TEST')
                {
                    // Then automatically change the Record Type to TEST Agreements.
                    agmt.RecordType = typeMap.get('TEST Agreements');
                }
        }          
    }
}



Any help would be great! Thanks!

Hi I have developed a visualforce page with a controller extension. That should allow the user to select a custom Object 'Territory_Account__c' for deletion (among other things) the problem is that the selected Territory Account is not returning True. The controller and visualforce page code is below. Any help would be great!

 

Page Controller:

public with Sharing class TerritoryController{
	
    ApexPages.StandardController con;
    public Territory__c Territory {get; set;}
    public List<TAWrapper> TAccounts {get;set;}
    private List<Territory_Account__c> TADeleteList = New List<Territory_Account__c>();
    private integer counter=0;  //keeps track of the offset
    public integer list_size=200; //sets the page size or number of rows
   	public integer total_size; //used to show user the total size of the list
    boolean DTA = False;
    Public Id TerritoryId;
    
    public TerritoryController(ApexPages.StandardController TController) {
    
      //  con = TController;
     //   Territory = (Territory__c)TController.getRecord();
        TerritoryId = ApexPages.CurrentPage().getParameters().get('id');
        
        total_size = [SELECT count() FROM Territory_Account__c WHERE Territory__c = :TerritoryId];
    }
    
    Public List<TAwrapper> getTAs() {	
        System.Debug('Joel: GetTAs has run');
        If(TAccounts == NULL) {
        	TAccounts = New List<TAWrapper>();
            For(Territory_Account__c TerAcc : [SELECT Id, Account__c, Account__r.name, Liberate_Cust_ID__c, Debtor_Group__c 
                                                   FROM Territory_Account__c 
                                                   WHERE Territory__c = :TerritoryId
                                                   ORDER BY Account__r.name
                                               	   LIMIT :list_size
                                                   OFFSET :counter])
                TAccounts.add(new TAWrapper(TerAcc,False));  
        } 
        return TAccounts;
    }
    

    Public class TAwrapper {

        Public TAwrapper(Territory_Account__c rTA, Boolean rSelected) {
            Selected = rSelected;
            TAccount = rTA;
        } 
        
        public Boolean Selected {get; set;}
        public Territory_Account__c TAccount {get; set;}
    }

    public PageReference DeleteTA() { 

        TADeleteList = New List<Territory_Account__c>();
        List<Id> TAIdList = New List<Id>();
        Territory_Account__c TAd;
	//	DTA = True;
        
    	For(TAWrapper TW : getTAs()) {
				System.debug('Joel: Print of TW '+TW);
                If(TW.Selected == True) {
                    System.Debug('Joel: TA is Selected');
                    TAIdList.Add(TW.TAccount.Id);
                }
            }
        
        If(TAIdList.Size()>0) { 
            For(Territory_Account__c Tac : [Select Id from Territory_Account__c where Id IN :TAIdList])
            	TADeleteList.Add(Tac);
            Delete TADeleteList;
            DTA = False;
         //   TAccounts = NULL;
            return NULL; //new PageReference(ApexPages.currentPage().getUrl());
        }
        else {
            System.Debug('Joel: TAdelete list is empty');
            ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.INFO,'No Territory Accounts Selected'));
            DTA = False;
            Return Null;
        }       
              
      	
   	}

 The Visualforce Page:

<apex:page standardController="Territory__c" extensions="TerritoryController">
    <apex:sectionHeader title="Territory" subtitle="{!Territory__c.Name}"/>
    <apex:pageMessages />
    <apex:detail subject="{!$CurrentPage.parameters.id}" relatedList="false" title="false"/> 
    
    <apex:includeScript value="https://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.js"/>
    <script type="text/javascript">
        jQuery.noConflict();        
        $j = jQuery;
        
        $j( function(){
            $j("input.SelectAll").click(function(event){                
                $j("table.AccountsTable input[type=checkbox]").attr("checked", event.target.checked);
            });
        
        });        
    </script>
     
    <apex:pageBlock Title="Territory Accounts">
		<apex:pageBlockButtons location="top" >
   			<apex:outputPanel id="myButtons">
                <apex:form >
                    <apex:commandButton action="{!NewTA}" title="New Territory Account" value="New Territory Account" style="font-size:x-small;"/>
                    <apex:commandButton action="{!DeleteTA}" title="Delete Territory Account" value="Delete Territory Account" style="font-size:x-small;"/><br/>
                 <!--   <apex:commandButton action="{!Beginning}" title="Beginning" value="First Page" disabled="{!disablePrevious}" reRender="myPanel,myButtons" style="font-size:xx-small;"/>
                    <apex:commandButton action="{!Previous}" title="Previous" value="Previous Page" disabled="{!disablePrevious}" reRender="myPanel,myButtons" style="font-size:xx-small;"/>        
                    <apex:commandButton action="{!Next}" title="Next" value="Next Page" disabled="{!disableNext}" reRender="myPanel,myButtons" style="font-size:xx-small;"/>
                    <apex:commandButton action="{!End}" title="End" value="Last Page" disabled="{!disableNext}" reRender="myPanel,myButtons" style="font-size:xx-small;"/>   -->
               </apex:form>
       		</apex:outputPanel>
   		</apex:pageBlockButtons>
        
        <apex:outputPanel id="myPanel">
            <apex:form >
                <apex:outputPanel rendered="{!total_size > list_size}" style="color:red;">
                    <apex:outputText value="{0,number,###0}"><apex:param value="{!total_size}" /></apex:outputText>
                    results found,&nbsp;  
                    <apex:outputText value="{0,number,###0}"><apex:param value="{!list_size}" /></apex:outputText>
                    displayed per page<br/> 
                </apex:outputPanel>
                <apex:outputPanel rendered="{!total_size>list_size}">
                    Go to page: &nbsp;&nbsp;
                    <apex:commandLink action="{!page1}" value="1" rendered="{!AND(counter!=0,total_size>list_size)}" rerender="myPanel,myButtons"/>
                    <apex:outputText value="1" rendered="{!AND(counter==0,total_size>list_size)}" style="color:#666666;"/>
                    &nbsp;&nbsp;
                    <apex:commandLink action="{!page2}" value="2" rendered="{!AND(OR(counter<list_size,counter>=(list_size*2)),total_size>(list_size))}" rerender="myPanel,myButtons"/>
                    <apex:outputText value="2" rendered="{!AND(counter>=list_size,counter<(list_size*2),total_size>(list_size))}" style="color:#666666;"/>
                    &nbsp;&nbsp;
                    <apex:commandLink action="{!page3}" value="3" rendered="{!AND(counter<(list_size*2),total_size>(list_size*2))}" rerender="myPanel,myButtons"/>
                    <apex:outputText value="3" rendered="{!AND(counter>=(list_size*2),counter<(list_size*3),total_size>(list_size*2))}" style="color:#666666;"/>
                    &nbsp;&nbsp;
                    <apex:commandLink action="{!page4}" value="4" rendered="{!AND(counter<(list_size*3),total_size>(list_size*3))}" rerender="myPanel,myButtons"/>
                    <apex:outputText value="4" rendered="{!AND(counter>=(list_size*3),counter<(list_size*4),total_size>(list_size*3))}" style="color:#666666;"/>
                    &nbsp;&nbsp;
                    <apex:commandLink action="{!page5}" value="5" rendered="{!AND(counter<(list_size*4),total_size>(list_size*4))}" rerender="myPanel,myButtons"/>
                    <apex:outputText value="5" rendered="{!AND(counter>=(list_size*4),counter<(list_size*5),total_size>(list_size*4))}" style="color:#666666;"/>
                </apex:outputPanel>
    	
            	<apex:pageblockTable styleClass="AccountsTable" id="accounts-table" value="{!TAs}" var="TA" >
            		<apex:column style="width:60px;">
                  		<apex:facet name="header">
                    		<input type="checkbox" class="SelectAll"/>Action                  
                  		</apex:facet>            
                        <apex:inputCheckbox value="{!TA.Selected}"/>   
            		</apex:column>
                    <apex:column value="{!TA.TAccount.Account__c}" />
                    <apex:column value="{!TA.TAccount.Liberate_Cust_ID__c}"/>
                    <apex:column value="{!TA.TAccount.Debtor_Group__c}"/>
    			</apex:pageblockTable>
            </apex:form>
        </apex:outputPanel>
    </apex:pageBlock>
</apex:page>