1

I have to convert the following button to salesforce console button to open as sub-tab.

parent.frames.location.replace ('a0o/e?CF00Nr0000000VUoP={!URLENCODE(Application__c.Name)}&CF00Nr0000000VUoP_lkid={!Application__c.Id}&saveURL=%2F{!Application__c.Id}&retURL=%2F{!Application__c.Id}')

2 Answers 2

1

You can use srcUp method

srcUp('a0o/e?CF00Nr0000000VUoP={!URLENCODE(Application__c.Name)}&CF00Nr0000000VUoP_lkid={!Application__c.Id}&saveURL=%2F{!Application__c.Id}&retURL=%2F{!Application__c.Id}');

Update you can try standard method too.

{!REQUIRESCRIPT("/support/console/30.0/integration.js")} 
if(typeof(srcUp) == 'function') //Checks that it is in console
{ 
var openSubtab = function(result){ 
sforce.console.openSubtab(result.id,'a0o/e?CF00Nr0000000VUoP={!URLENCODE(Application__c.Name)}&CF00Nr0000000VUoP_lkid={!Application__c.Id}&saveURL=%2F{!Application__c.Id}&retURL=%2F{!Application__c.Id}', true, 'Subtab Name', null); 
}; 
sforce.console.getEnclosingPrimaryTabId(openSubtab); 

} 
else{ 
window.parent.location.href=('a0o/e?CF00Nr0000000VUoP={!URLENCODE(Application__c.Name)}&CF00Nr0000000VUoP_lkid={!Application__c.Id}&saveURL=%2F{!Application__c.Id}&retURL=%2F{!Application__c.Id}') 
}

This will open as sub tab in service cloud and will work in normal window as well.

4
  • Added the srcUp but getting an Privilege error. "You do not have the level of access necessary to perform the operation you requested. Please contact the owner of the record or your administrator if access is necessary. For more information, see Insufficient Privileges Errors." May 30, 2016 at 5:18
  • @SalesforceLearner check my updated answer. May 30, 2016 at 6:14
  • No luck still the same error. I tried both list button and detail button for onlick javascript May 30, 2016 at 6:47
  • You can also use custom console component!
    – DarkSkull
    May 30, 2016 at 9:28
1

@SalesforceLearner, Since it's a edit page(noticed by your /e... in the url) and you have commented in @TusharSharma's answer as Insufficient Privileges Errors.I would make sure to check the User's Profile has 'Create'(must)/Edit permission on the specified key prefixes(a0o - object ), then for sure srcUp mentioned below will work in console.

   srcUp('a0o/e?CF00Nr0000000VUoP={!URLENCODE(Application__c.Name)}&CF00Nr0000000VUoP_lkid={!Application__c.Id}&saveURL=%2F{!Application__c.Id}&retURL=%2F{!Application__c.Id}');
4
  • 1
    @MohithShrivastava His post is a legit answer. He's responding to the OP's comments under Tushar's answer to the question. This should not be deleted. - From Review
    – crmprogdev
    May 30, 2016 at 13:32
  • @crmprogdev Ah i see .my bad .The way answer is framed is bit confusing and misleading . May 30, 2016 at 13:34
  • 1
    @MohithShrivastava I always try to look at the entire post on these when they reference something else before voting (ditto for close votes that have answers).
    – crmprogdev
    May 30, 2016 at 13:44
  • 3
    Thank you @crmprogdev. Since I am not able to comment on the existing answer ( min 50 rep needed ) , I have added as another answer. MohithShrivastava, Thanks, I hope its clear now.
    – Valli S
    May 30, 2016 at 13:57

You must log in to answer this question.

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