I have a visualforce page that has a list of opportunity products and in this there is a column where you can either create a new related item or lookup an existing item (of a custom object). Looking up an existing item is working fine, but creating a new one and returing to this page is not working for me.
When creating a new item, I have it currently working so that after clicking save on the standard edit page using saveurl, it returns to my visual force page. The next thing I need to happen is that there needs to be an id of the opportunity product passed with the saveurl so that I know which opportunity product to add this item I just created to.
Here is the section of my visualforce page where I create the parameter:
<apex:column headerValue=""> <apex:commandButton action="{!onCreateNew}" value="Create New Item"> <apex:param value="{!a.Id}" assignTo="{!aID}" name="aID"/> </apex:commandButton> </apex:column>
Here is the section of my controller where I create the page reference:
public String aID { get; set;} public PageReference onCreateNew(){ return new PageReference('/a0W/e?saveURL=%2Fapex%2FOpptProdEngineeringEdit?id=' + ApexPages.currentPage().getParameters().get('Id') + '%26passID%3D' + aID +'&cancelURL=%2Fapex%2FOpptProdEngineeringEdit?id=' + ApexPages.currentPage().getParameters().get('Id') + '&RecordType=012g00000000JWI'); }
This section of my controller:
'%26passID%3D' + aID
is where I'm trying to pass the ID of "a" in the saveurl... but no matter what I do it is returning null. Any suggestions?
'/a0W/e?saveURL=%2Fapex%2FOpptProdEngineeringEdit?id='