+ Start a Discussion
alex51atlasalex51atlas 

Page action error: java.lang.IllegalArgumentException: Illegal view ID '. The ID must begin with /

java.lang.IllegalArgumentException: Illegal view ID '. The ID must begin with / 

 

I have the following VF page, whose controller performs some validation logic and if succesful redirects, in a new window, to a visualforce page rendered as a PDF. Afterwards the logic inside the addTitleVISubmissions function (from the action tag) is executed .

 

<apex:page standardController="Campaign" extensions="TitleVIMailController" action="{!addTitleVISubmissions}">
...
</apex:page>

 The addTitleVISubmissions function looks like so:

public PageReference addTitleVISubmissions() {
	if ( !errorsFound && whichLetter.equalsIgnoreCase('first') ) {
		List <OCIO_Title_VI_Submission__c> titleVISubmissions = 
			new List<OCIO_Title_VI_Submission__c>();

		for ( CampaignMember curr : contactList ) {
			OCIO_Title_VI_Submission__c currSubmission = new OCIO_Title_VI_Submission__c();
			currSubmission.OCR_Donee_Contact__c = curr.ContactId; // The issue comes with this lookup field

			currSubmission.OCR_Submission_Status__c = 'No Activity';
			currSubmission.OCR_Rollout__c = campgn.Id;
			titleVISubmissions.add(currSubmission);
		}
		database.insert(titleVISubmissions);
	}
	return null;
}

Anyway, I've pin pointed an issue with writing to the OCR_Donee_Contact__c field (simple lookup field to Contact). If I leave the code as is above, instead of rending the dynamic PDF page I get the following error:

 

java.lang.IllegalArgumentException: Illegal view ID '. The ID must begin with / 

 

The records generated in the for loop are correctly inserted, but the user sees a salesforce page with the error above instead of the visualforce PDF page.

 

If I comment out that line, everything works fine, the PDF is displayed and the records are inserted. However, since I commented out the line that populates the lookup field I don't have a reference to the contacts on these records.

 

I've looked into this error and it seems like it occurs if the action function contains a string literal instead of a function name, but this is clearly not the case here. Can anyone shed some light as to why the system would behave this way or why I am getting this issue in this situation?

 

Thanks in advance.

 

 

 

 

_Prasu__Prasu_

You are returning the PageReference from the method, make it void and return nothing. May solve your problem