You need to sign in to do that
Don't have an account?
Vanitha Mani
how to open page in subtab lightning console
Hi i have command button when clicked its overriding the page instead i need to open it in its own subtab in lightning.
<apex:commandButton value="Clone Package To Selected CRs" action="{!clonePackageToChangeRequests}" reRender="pbId" status="fetchStatus" rendered="{!NOT(isCompleted)}"/>
Controller:
public PageReference clonePackageToChangeRequests() {
Savepoint sp = Database.setSavepoint();
try {
Set<ID> crIds = new Set<ID>();
for (SelectableChangeRequest record : changeRequests) {
if(record.selected && record.obj.Customer_Packages__r.size() > 0) { //TKT-1239114
throw new CloneChangeRequestException(EXCEPTION_NAME);
}else if (record.selected) {
crIds.add(record.obj.Id);
}
}
if (crIds.size() > 0) {
return handleSuccess(SVC_CR_Package_Service.clonePackage(crIds, crPackage.Id));
}
} catch (Exception e) {
Database.rollback(sp);
ApexPages.addMessage(SVC_ErrorHandler.logAndConvertToApexMessage(e));
}
return null;
}
private PageReference redirect(ID recordId) {
PageReference retURL = new PageReference('/' + recordId);
retURL.setRedirect(true);
return retURL;
}
I read more articles on this but i couldnt find the solution since there is a condition that if the package is present it should throw exception and if not it clones the package and should open that package in subtab..Can anyone help me with this code.
<apex:commandButton value="Clone Package To Selected CRs" action="{!clonePackageToChangeRequests}" reRender="pbId" status="fetchStatus" rendered="{!NOT(isCompleted)}"/>
Controller:
public PageReference clonePackageToChangeRequests() {
Savepoint sp = Database.setSavepoint();
try {
Set<ID> crIds = new Set<ID>();
for (SelectableChangeRequest record : changeRequests) {
if(record.selected && record.obj.Customer_Packages__r.size() > 0) { //TKT-1239114
throw new CloneChangeRequestException(EXCEPTION_NAME);
}else if (record.selected) {
crIds.add(record.obj.Id);
}
}
if (crIds.size() > 0) {
return handleSuccess(SVC_CR_Package_Service.clonePackage(crIds, crPackage.Id));
}
} catch (Exception e) {
Database.rollback(sp);
ApexPages.addMessage(SVC_ErrorHandler.logAndConvertToApexMessage(e));
}
return null;
}
private PageReference redirect(ID recordId) {
PageReference retURL = new PageReference('/' + recordId);
retURL.setRedirect(true);
return retURL;
}
I read more articles on this but i couldnt find the solution since there is a condition that if the package is present it should throw exception and if not it clones the package and should open that package in subtab..Can anyone help me with this code.
Not sure if apex:commandlink (https://developer.salesforce.com/docs/atlas.en-us.pages.meta/pages/pages_compref_commandLink.htm) can work for you, it has a attribute name "target" if value is "_blank" for it, will open Url in new tab.
If apex:commandlink doesn't works in this context, a javascript funciton can be written and called onclick event which can do the link redirection.
Thanks.