0

I have a requirement to open a primary tab by clicking on anchor tag.

It is happening but if I come back to the previous tab it's getting changed like primary tab. I know the issue is we have to pass return true while calling OpenPrimaryTab().

<tr ng-repeat="case in Caseinformation|orderBy:sortType:sortReverse |      filter:query " style="height:1px;" class="data-row">          
     <td style="text-align:left;"><a ng-href="/{{case.caseId}}" ng-click= "openPrimaryCaseTab(case.caseId,case.caseNumber);return false">{{case.CaseNumber}}</a></td>

//Javascript

$scope.openPrimaryCaseTab = function (recordID,caseNumber) {
    alert('open primary tab'+recordID);
    sforce.console.openPrimaryTab(null,recordID,true,caseNumber); 
    }

return false is not working in ng-click, please suggest some workaround.

1 Answer 1

1

Try below approach:

<tr ng-repeat="case in Caseinformation|orderBy:sortType:sortReverse |      filter:query " style="height:1px;" class="data-row">          
     <td style="text-align:left;"><a ng-href="/{{case.caseId}}" ng-click= " return openPrimaryCaseTab(case.caseId,case.caseNumber);">{{case.CaseNumber}}</a></td>

Angular Function:

$scope.openPrimaryCaseTab = function (recordID,caseNumber) {
    alert('open primary tab'+recordID);
    sforce.console.openPrimaryTab(null,recordID,true,caseNumber); 
    return false; // or any value based on
    }

sforce.console.openPrimaryTab return true/false based on tab is opened or not.

3
  • I changed my code according to your suggestion but now i am not able to open a primary tab page is opening in same view. Feb 7, 2017 at 6:55
  • Looks like you need to manage return false; // or any value based on. Also check the console, you should not get any error by Angualr JS @lokeshkumar
    – Ashwani
    Feb 7, 2017 at 7:00
  • if I am putting return before method I am getting the parse error. could you please tell how I put return false. @Ashwani Feb 7, 2017 at 8:06

You must log in to answer this question.

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