2

Just like the title says, whenever I click my 'Del' link, the delete works fine but the redirect is cutting off part of the package prefix.

Example: Working: https://myprefix.na15.visual.force.com/apex/MyPageName?id=a000000000ISez4AAD&type=Blabla&name=Bleble

After delete: https://m.na15.visual.force.com/apex/MyPageName?id=a000000000ISez4AAD&type=Blabla&name=Bleble

Only the 'm' stands (I supposing the 'm' letter comes from the prefix).

<apex:outputLink styleClass="actionLink" value="{!URLFOR($Action.SomeCustomObject__c.Delete, item.id, [retURL='/apex/Tocodo?id='+delId])}" onclick="return confirmDelete();">Del</apex:outputLink>

The redirect works fine in the development org, wrong after I install the new package in another org.

Best regards.

0

2 Answers 2

1

In your packaging org, from where you are creating package replace retUrl='apex/tocode?id='+delid with

'apex/mynamespaceprefix__tocode?id='+delid 
1
  • Thank you, this answer simplifies this process a lot, it works!
    – Rui Rocha
    Mar 3, 2014 at 15:38
2

Try building up a PageReference in the controller class and using that instead. It will handle both the packaged and unpackaged scenarios.

E.g.

PageReference redirectPage = Page.MyPageName;
redirectPage.getParameters().put('id', delId);

SomeCustomObject__c so = new SomeCustomObject__c();
so.Id = item.Id;
ApexPages.StandardController sc = new ApexPages.StandardController(so);
PageReference deletePr = sc.delete();

deletePr.getParameters().put('retURL', redirectPage.getUrl());

return deletePr;
1
  • This answer also works, since I used the other answer because of being quicker to implement (which is something I need) I've check it as being the answer. Thank you very much aswell.
    – Rui Rocha
    Mar 3, 2014 at 15:39

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .