• sphoid
  • NEWBIE
  • 25 Points
  • Member since 2010

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

I am experiencing a cryptic error when I submit a form designed to process selected campaigns. I am using a controller extension class to extend the standard campaign controller so i can process campaigns selected in search results, etc. The error is something along the lines of "j_id0:j_id2:j_id30:j_id31:0:j_id34: An error occurred when processing your submitted information". Submitting the same form/same data as a System Administrator does not result in this error. I have all of my Apex classes/visualforce pages configured to be accessible to both the System Administrator as well as the Standard User profile. The Custom Setting that is referenced in the controller extension has a visibility of Public.

 

Here is the controller extension code:

public class CampaignControllerExtension {

private final List selectedCampaigns;

public List selectedSynchCampaigns {
get {
if (selectedSynchCampaigns == null){
selectedSynchCampaigns = new List();

PostalSynchronizedCampaign__c psc = null;

for (Campaign c: this.selectedCampaigns){
psc = PostalSynchronizedCampaign__c.getInstance(c.Name);
if (psc != null)
selectedSynchCampaigns.add(psc);
else {
psc = new PostalSynchronizedCampaign__c();
psc.Name = c.Name;
psc.Postal_List__c = c.Name;
psc.CampaignId__c = c.Id;
psc.Synchronized__c = true;
selectedSynchCampaigns.add(psc);
}
}
}
return selectedSynchCampaigns;

}

set;
}

public CampaignControllerExtension(ApexPages.StandardController pController){
Campaign c = (Campaign) pController.getRecord();
Campaign campaign = [SELECT Id, Name FROM Campaign WHERE Id = :c.Id];
this.selectedCampaigns = new List();
this.selectedCampaigns.add(campaign);
}

public CampaignControllerExtension(ApexPages.StandardSetController pController){
this.selectedCampaigns = new List();
List campaigns = (List) pController.getSelected();
for (Campaign c: campaigns){
this.selectedCampaigns.add([SELECT Id, Name FROM Campaign WHERE Id = :c.Id]);
}
}

public PageReference updateSynchronization(){

for (PostalSynchronizedCampaign__c psc: this.selectedSynchCampaigns){

if (psc.Synchronized__c == true){
if (psc.Id != null)
update psc;
else
insert psc;
} else {
if (psc.Id != null)
delete psc;
}

}
ApexPages.addMessage(new ApexPages.message(ApexPages.Severity.INFO, 'Updated synchronized campaigns'));
return null;
}

public PageReference exportCampaigns(){

PostalExporter exporter = new PostalExporter();

Boolean result = false;

exporter.exportCampaigns(this.selectedSynchCampaigns);
ApexPages.addMessage(new ApexPages.message(ApexPages.Severity.INFO, 'Exported ' + this.selectedSynchCampaigns.size() + ' Campaigns'));

return null;
}

}

 

Here is the visualforce code:

<apex:page standardController="Campaign" recordSetVar="campaigns" extensions="CampaignControllerExtension">
    <apex:sectionHeader title="Synchronize Campaigns" subtitle="The following campaigns will be automatically synchronized with Switchbox. You can edit the synchronization settings later in the Switchbox tab."/>        
                  <apex:form >        
                  <apex:pageMessages />  
                  <apex:pageBlock title="Selected Campaigns">                
                               <apex:pageBlocKTable value="{!selectedSynchCampaigns}" var="sc">                                                                                      
                                              <apex:column headerValue="Campaign" value="{!sc.Name}"></apex:column>                                                                 
                                              <apex:column headerValue="List Name"><apex:inputText value="{!sc.Postal_List__c}" /></apex:column>                                                                           </apex:pageBlocKTable>                                        
                                <apex:commandButton action="{!exportCampaigns}" value="Export"  />        
                    </apex:pageBlock>  
                  </apex:form>
</apex:page>

 

  • September 03, 2010
  • Like
  • 0

I am writing some unit tests for one of my apex class methods that is defined as follows:

 

public with sharing class PostalClient {

    //snip

    public Dom.Document multiUpsertSubscribers(Map<String, List<Map<String, String>>> pListFields){
          //snip
    }

    //snip
}

My test method is defined as follows:

static testMethod void multiUpsertSubscribers(){
    	PostalClient.testingMode = true;
        String expectedResponse = '<?xml version="1.0" encoding="UTF-8"?><response />';
        Long clientId   =  42;  
        String username = 'brandon';
        String password = 'password';
                        
        PostalClient client = new PostalClient(clientId, username, password);        
        
        List<Map<String, String>> fieldsList = null;
		
		Map<String, List<Map<String, String>>> listFields = new Map<String, List<Map<String, String>>>();
		
		Map<String, String> fields0 = new Map<String, String>();
		fields0.put('name', 'email');
        fields0.put('value', 'test@eroi.com');
        fields0.put('name', 'Favorite Ice Cream');
        fields0.put('value', 'Rocky Road');
        fieldsList = new List<Map<String, String>>();
        fieldsList.add(fields0);
        listFields.put('The Hit List', fieldsList);
        
        Map<String, String> fields1 = new Map<String, String>();
		fields1.put('name', 'email');
        fields1.put('value', 'test2@eroi.com');
        fields1.put('name', 'Favorite Ice Cream');
        fields1.put('value', 'Chunky Monkey');		
		fieldsList = new List<Map<String, String>>();
		fieldsList.add(fields1);
		listFields.put('The Other List', fieldsList);
		
		Dom.Document xml = null;
		String actualResponse = null;
					
		xml = postalClient.multiUpsertSubscribers(listFields);				
		actualResponse  = xml.toXmlString();        
        System.assertEquals(expectedResponse, actualResponse);
        
    }

The problematic line is:

xml = postalClient.multiUpsertSubscribers(listFields);	

The error that I am given is: Error: Compile Error: Method does not exist or incorrect signature: postalClient.multiUpsertSubscribers(MAP:String,LIST:MAP:String,String) at line 333 column 15

This puzzles me since there is in fact a method with this signature but it is not being recognized in the test class. I suspect it might be choking on the nested collection as a parameter but it doesn't appear to violate any limitations that I know of. Any help would be appreciated.

I'm fairly new to apex/visual force and I'm having a strange error that I am unsure how to troubleshoot.

 

I have a form in visualforce

    <apex:page controller="SyncController">
<apex:sectionHeader title="Manual Export" subtitle="Manually export contacts and/or leads to your Postal mailing lists"/>

<apex:pageMessages />

<apex:form id="exportForm">

<apex:pageBlock title="List Settings">

<label>List Name</label> <apex:inputtext id="listName" required="true"/><br/>

</apex:pageBlock>

<apex:pageBlock title="Export Type">

<apex:selectRadio id="exportType" value="{!exportType}" required="true">
<apex:selectOptions value="{!exportTypes}"/>
</apex:selectRadio>


</apex:pageBlock>

<apex:commandButton action="{!manualExport}" value="Export" />
</apex:form>

</apex:page>

And my controller looks like this:

public with sharing class SyncController {

	public String exportType {get;set;}
	public String listName {get;set;}
	
	public PostalAccount__c account;
		
	public Integer contactsExported = 0;
	public Integer leadsExported = 0;
			
	public SyncController(){
		this.account = PostalAccount__c.getInstance();
		if (this.account == null){			
			ApexPages.addMessage(new ApexPages.message(ApexPages.severity.ERROR, 'You must configure your Postal Account settings before you can export'));			
		}
	}
	
	public Boolean exportReady{
		get {
			if (this.account == null)
				return false;
			else
				return true;
		}
	}
			
	public List exportTypes{
		get {
			List exportTypes = new List();
			exportTypes.add(new SelectOption('C', 'Contacts'));
			exportTypes.add(new SelectOption('L', 'Leads'));
			exportTypes.add(new SelectOption('LC', 'Leads and Contacts'));
			return exportTypes;
		}
	}

	public PageReference manualExport(){
		this.exportType = ApexPages.currentPage().getParameters().get('exportType');
		this.listName = ApexPages.currentPage().getParameters().get('listName');
		
		PostalExporter exporter = new PostalExporter(this.account.Postal_Domain__c, this.account.Postal_User__c, this.account.Postal_Password__c);
		Boolean result;
		
		if (this.exportType.compareTo('C') == 0){
			result = exporter.exportContacts();
			if (result){
				ApexPages.addMessage(new ApexPages.message(ApexPages.Severity.INFO, 'Exported ' + exporter.contactsExported + ' Contacts'));
			}
		} else if (this.exportType.compareTo('L') == 0){
			result = exporter.exportLeads();
			if (result){
				ApexPages.addMessage(new ApexPages.message(ApexPages.Severity.INFO, 'Exported ' + exporter.leadsExported + ' Leads'));
			}
		} else if (this.exportType.compareTo('LC') == 0){
			result = exporter.exportAll();
			if (result){
				ApexPages.addMessage(new ApexPages.message(ApexPages.Severity.INFO, 'Exported ' + exporter.contactsExported + ' Contacts'));
				ApexPages.addMessage(new ApexPages.message(ApexPages.Severity.INFO, 'Exported ' + exporter.leadsExported + ' Leads'));
			}
		} else {
			ApexPages.addMessage(new ApexPages.message(ApexPages.severity.ERROR, 'Invalid export type'));
			result = false;
		}
		
		if (result == false)
			ApexPages.addMessage(new ApexPages.message(ApexPages.severity.ERROR, 'Export failed'));
				
		return null;
	}
	
}

Since i'm in the preliminary stages of development my exporter class does nothing but return true or false for now so all i want to happen is to go back to the form and just show some debug statements. The problem is I am getting a very cryptic error when i submit the form:

end tag name </HEAD> must be the same as start tag <META> from line 2 (position: TEXT seen ...:verdana,sans-serif}PRE{font-family:sans-serif}--></STYLE>\n</HEAD>... @5:8) 

I am stumped so any insight would be appreciated. thanks.

  • April 22, 2010
  • Like
  • 0

I am experiencing a cryptic error when I submit a form designed to process selected campaigns. I am using a controller extension class to extend the standard campaign controller so i can process campaigns selected in search results, etc. The error is something along the lines of "j_id0:j_id2:j_id30:j_id31:0:j_id34: An error occurred when processing your submitted information". Submitting the same form/same data as a System Administrator does not result in this error. I have all of my Apex classes/visualforce pages configured to be accessible to both the System Administrator as well as the Standard User profile. The Custom Setting that is referenced in the controller extension has a visibility of Public.

 

Here is the controller extension code:

public class CampaignControllerExtension {

private final List selectedCampaigns;

public List selectedSynchCampaigns {
get {
if (selectedSynchCampaigns == null){
selectedSynchCampaigns = new List();

PostalSynchronizedCampaign__c psc = null;

for (Campaign c: this.selectedCampaigns){
psc = PostalSynchronizedCampaign__c.getInstance(c.Name);
if (psc != null)
selectedSynchCampaigns.add(psc);
else {
psc = new PostalSynchronizedCampaign__c();
psc.Name = c.Name;
psc.Postal_List__c = c.Name;
psc.CampaignId__c = c.Id;
psc.Synchronized__c = true;
selectedSynchCampaigns.add(psc);
}
}
}
return selectedSynchCampaigns;

}

set;
}

public CampaignControllerExtension(ApexPages.StandardController pController){
Campaign c = (Campaign) pController.getRecord();
Campaign campaign = [SELECT Id, Name FROM Campaign WHERE Id = :c.Id];
this.selectedCampaigns = new List();
this.selectedCampaigns.add(campaign);
}

public CampaignControllerExtension(ApexPages.StandardSetController pController){
this.selectedCampaigns = new List();
List campaigns = (List) pController.getSelected();
for (Campaign c: campaigns){
this.selectedCampaigns.add([SELECT Id, Name FROM Campaign WHERE Id = :c.Id]);
}
}

public PageReference updateSynchronization(){

for (PostalSynchronizedCampaign__c psc: this.selectedSynchCampaigns){

if (psc.Synchronized__c == true){
if (psc.Id != null)
update psc;
else
insert psc;
} else {
if (psc.Id != null)
delete psc;
}

}
ApexPages.addMessage(new ApexPages.message(ApexPages.Severity.INFO, 'Updated synchronized campaigns'));
return null;
}

public PageReference exportCampaigns(){

PostalExporter exporter = new PostalExporter();

Boolean result = false;

exporter.exportCampaigns(this.selectedSynchCampaigns);
ApexPages.addMessage(new ApexPages.message(ApexPages.Severity.INFO, 'Exported ' + this.selectedSynchCampaigns.size() + ' Campaigns'));

return null;
}

}

 

Here is the visualforce code:

<apex:page standardController="Campaign" recordSetVar="campaigns" extensions="CampaignControllerExtension">
    <apex:sectionHeader title="Synchronize Campaigns" subtitle="The following campaigns will be automatically synchronized with Switchbox. You can edit the synchronization settings later in the Switchbox tab."/>        
                  <apex:form >        
                  <apex:pageMessages />  
                  <apex:pageBlock title="Selected Campaigns">                
                               <apex:pageBlocKTable value="{!selectedSynchCampaigns}" var="sc">                                                                                      
                                              <apex:column headerValue="Campaign" value="{!sc.Name}"></apex:column>                                                                 
                                              <apex:column headerValue="List Name"><apex:inputText value="{!sc.Postal_List__c}" /></apex:column>                                                                           </apex:pageBlocKTable>                                        
                                <apex:commandButton action="{!exportCampaigns}" value="Export"  />        
                    </apex:pageBlock>  
                  </apex:form>
</apex:page>

 

  • September 03, 2010
  • Like
  • 0

I am writing some unit tests for one of my apex class methods that is defined as follows:

 

public with sharing class PostalClient {

    //snip

    public Dom.Document multiUpsertSubscribers(Map<String, List<Map<String, String>>> pListFields){
          //snip
    }

    //snip
}

My test method is defined as follows:

static testMethod void multiUpsertSubscribers(){
    	PostalClient.testingMode = true;
        String expectedResponse = '<?xml version="1.0" encoding="UTF-8"?><response />';
        Long clientId   =  42;  
        String username = 'brandon';
        String password = 'password';
                        
        PostalClient client = new PostalClient(clientId, username, password);        
        
        List<Map<String, String>> fieldsList = null;
		
		Map<String, List<Map<String, String>>> listFields = new Map<String, List<Map<String, String>>>();
		
		Map<String, String> fields0 = new Map<String, String>();
		fields0.put('name', 'email');
        fields0.put('value', 'test@eroi.com');
        fields0.put('name', 'Favorite Ice Cream');
        fields0.put('value', 'Rocky Road');
        fieldsList = new List<Map<String, String>>();
        fieldsList.add(fields0);
        listFields.put('The Hit List', fieldsList);
        
        Map<String, String> fields1 = new Map<String, String>();
		fields1.put('name', 'email');
        fields1.put('value', 'test2@eroi.com');
        fields1.put('name', 'Favorite Ice Cream');
        fields1.put('value', 'Chunky Monkey');		
		fieldsList = new List<Map<String, String>>();
		fieldsList.add(fields1);
		listFields.put('The Other List', fieldsList);
		
		Dom.Document xml = null;
		String actualResponse = null;
					
		xml = postalClient.multiUpsertSubscribers(listFields);				
		actualResponse  = xml.toXmlString();        
        System.assertEquals(expectedResponse, actualResponse);
        
    }

The problematic line is:

xml = postalClient.multiUpsertSubscribers(listFields);	

The error that I am given is: Error: Compile Error: Method does not exist or incorrect signature: postalClient.multiUpsertSubscribers(MAP:String,LIST:MAP:String,String) at line 333 column 15

This puzzles me since there is in fact a method with this signature but it is not being recognized in the test class. I suspect it might be choking on the nested collection as a parameter but it doesn't appear to violate any limitations that I know of. Any help would be appreciated.

I'm fairly new to apex/visual force and I'm having a strange error that I am unsure how to troubleshoot.

 

I have a form in visualforce

    <apex:page controller="SyncController">
<apex:sectionHeader title="Manual Export" subtitle="Manually export contacts and/or leads to your Postal mailing lists"/>

<apex:pageMessages />

<apex:form id="exportForm">

<apex:pageBlock title="List Settings">

<label>List Name</label> <apex:inputtext id="listName" required="true"/><br/>

</apex:pageBlock>

<apex:pageBlock title="Export Type">

<apex:selectRadio id="exportType" value="{!exportType}" required="true">
<apex:selectOptions value="{!exportTypes}"/>
</apex:selectRadio>


</apex:pageBlock>

<apex:commandButton action="{!manualExport}" value="Export" />
</apex:form>

</apex:page>

And my controller looks like this:

public with sharing class SyncController {

	public String exportType {get;set;}
	public String listName {get;set;}
	
	public PostalAccount__c account;
		
	public Integer contactsExported = 0;
	public Integer leadsExported = 0;
			
	public SyncController(){
		this.account = PostalAccount__c.getInstance();
		if (this.account == null){			
			ApexPages.addMessage(new ApexPages.message(ApexPages.severity.ERROR, 'You must configure your Postal Account settings before you can export'));			
		}
	}
	
	public Boolean exportReady{
		get {
			if (this.account == null)
				return false;
			else
				return true;
		}
	}
			
	public List exportTypes{
		get {
			List exportTypes = new List();
			exportTypes.add(new SelectOption('C', 'Contacts'));
			exportTypes.add(new SelectOption('L', 'Leads'));
			exportTypes.add(new SelectOption('LC', 'Leads and Contacts'));
			return exportTypes;
		}
	}

	public PageReference manualExport(){
		this.exportType = ApexPages.currentPage().getParameters().get('exportType');
		this.listName = ApexPages.currentPage().getParameters().get('listName');
		
		PostalExporter exporter = new PostalExporter(this.account.Postal_Domain__c, this.account.Postal_User__c, this.account.Postal_Password__c);
		Boolean result;
		
		if (this.exportType.compareTo('C') == 0){
			result = exporter.exportContacts();
			if (result){
				ApexPages.addMessage(new ApexPages.message(ApexPages.Severity.INFO, 'Exported ' + exporter.contactsExported + ' Contacts'));
			}
		} else if (this.exportType.compareTo('L') == 0){
			result = exporter.exportLeads();
			if (result){
				ApexPages.addMessage(new ApexPages.message(ApexPages.Severity.INFO, 'Exported ' + exporter.leadsExported + ' Leads'));
			}
		} else if (this.exportType.compareTo('LC') == 0){
			result = exporter.exportAll();
			if (result){
				ApexPages.addMessage(new ApexPages.message(ApexPages.Severity.INFO, 'Exported ' + exporter.contactsExported + ' Contacts'));
				ApexPages.addMessage(new ApexPages.message(ApexPages.Severity.INFO, 'Exported ' + exporter.leadsExported + ' Leads'));
			}
		} else {
			ApexPages.addMessage(new ApexPages.message(ApexPages.severity.ERROR, 'Invalid export type'));
			result = false;
		}
		
		if (result == false)
			ApexPages.addMessage(new ApexPages.message(ApexPages.severity.ERROR, 'Export failed'));
				
		return null;
	}
	
}

Since i'm in the preliminary stages of development my exporter class does nothing but return true or false for now so all i want to happen is to go back to the form and just show some debug statements. The problem is I am getting a very cryptic error when i submit the form:

end tag name </HEAD> must be the same as start tag <META> from line 2 (position: TEXT seen ...:verdana,sans-serif}PRE{font-family:sans-serif}--></STYLE>\n</HEAD>... @5:8) 

I am stumped so any insight would be appreciated. thanks.

  • April 22, 2010
  • Like
  • 0