You need to sign in to do that
Don't have an account?
Cryptic error when using controller extensions as Standard User
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: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."/>
j_id0:j_id2:j_id30:j_id31:0:j_id34 is the HTML element id of an input field whose value could not successfully be submitted back. I've found that I hit these kind of things when I have validation rules on particular fields etc.
That said, looking at your VF page it seems that the only candidate for this is the inputtext backed by sc.Postal_List__c. Is there anything special about this field - e.g. not writable by standard user?
Campaigns and VF/Sites can be tricky because of the 'Marketing User' setting in a user record, which I was told isn't available via Sites etc...
I would check the user you are using has Marketing User' = true, and then look in the debug log to see if you get any insights...and add Apex:Messages to your page...
Thanks. The user I am testing with is already has Marketing user checked. I cannot see anything special about the Custom Setting I am referencing in the controller extension/vf page. I have visibility set to public and I don't see any more granular permission settings for custom settings.
I would add <apex:messages> to your page,and then wrap the main function call in Export in in a try {} catch {} statement, and add the exception message to the apex messages - that might then tell you more what is causing the error...
I had already done this to display some success/fail messages and I went so far as to add more messages to see where the error occurs. It appears to be occuring before it ever hits my controller extension.
None of my messages appear. I continue to get the cryptic error message. I also tried to wrap this method in a try/catch block with the same results. Something appears to be breaking in the standard campaign controller.
In that case, I can only suggest setting the debug log for both the admin and standard user, and viewing the page as both, and comparing where the standard user stops working...
You should maybe enter a support case. That error message is certainly not helpful or appropriate.