function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Deepu Gupta 29Deepu Gupta 29 

java script code issue

Hi All,
My code is like this :
<apex:page standardController="Account">
  <apex:form >
  <apex:pageBlock > 
<apex:pageBlockSection title="Account Hierarchy" columns="2">

  <c:HierarchyTree currId="{!Account.id}" />
  
</apex:pageBlockSection>
</apex:pageBlock>
<table align ="centre">
<tr>
 <td><apex:commandLink action="{!Cancel}" target="_top" value="BacktoAccount" id="theButton1"/></td>
 <td></td>
 <td></td>
<td><apex:commandLink value="IncludeContact" target="_top" onclick="redirect();"/></td>
 </tr>   
<script>
    
   function redirect(){
      var accId = '{!$CurrentPage.parameters.Id}';

        if( (typeof sforce != 'undefined') && (sforce != null) ) {
         sforce.one.navigateToURL('/apex/Hierarchy_Clone?id='+accId);
        }
        
        else{
       
        window.open('/apex/Hierarchy_Clone?id='+accId,'_parent');
     
        }
       } 
  </script>
  
  </table>
     </apex:form>
</apex:page>

But its not navigating me on the Hierarchy_Clone page on the clickling the link of the Inculde Contact.Could any one suggest me on that?Its on urgent basis.
Rohit Sharma 66Rohit Sharma 66
Can you please try putting the alert inside the javascript code, it will hepl u determine till where your code is executing. And what is the use of line 22, why u not checking the accId field instead, like accId not null and not blank.