I have a custom code that I am inserting a Account and open the Standard Account screen as Edit. I would like after the Save button pressed, go to the Standard Account view screen.
So, I am using RetURL for this adding the AccountID on that. It is working fine for internal user.
On the other hand, it does not work for Partner users. I know that if I added the Partner Community Name in the RetURL, it will work fine.
it is the code that is working fine for internal users:
Map<String,String> parameters = new Map<String,String>{
'objectName' => 'Account',
'recordId' => NewAccount.ID,
'retUrl' => NewAccount.ID
};
PageReference redirectPage = new ApexPages.StandardController(NewAccount).Edit();
redirectPage.getParameters().putAll(parameters);
redirectPage.setRedirect(True);
return redirectPage;
And here, the code that works fine for Partner Community. However, I do not want to hard code the Partner Community Name.
Map<String,String> parameters = new Map<String,String>{
'objectName' => 'Account',
'recordId' => NewAccount.ID,
'retUrl' => 'Partner/' + NewAccount.ID
};
PageReference redirectPage = new ApexPages.StandardController(NewAccount).Edit();
redirectPage.getParameters().putAll(parameters);
redirectPage.setRedirect(True);
return redirectPage;
So, how could I discover the Partner Community name. Or is there another way to use RetURL?