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
Heather Palosaari 12Heather Palosaari 12 

How to use custom URLs in a html table on a visualforce page, that works with mobile?

Scenario: I created a simple html table on an embedded visualforce page that displays data from the record it is on.  When the user clicks a row it takes them to a report that is filtered by the record ID to show them more information.  I need it to open a new window when on the browser (this works) and navigate inside the Salesforce1 app to the report on mobile (this does not work, it opens a new browser window).  

I know I will need an if statement later to determine where they are opening it (browser or Salesforce1) but for now I can't even get it to work in SF1 properly to worry about that yet.
 This is what I have tried:

**Please note the first row <tr> I tired using a variable - this failed miserably probably for obvious reasons.  The second row <tr> works but opens up a browser window in mobile**
<apex:page standardController="Engagement__c" showHeader="true">
   <script>
    function setupLinks(){
    	var initialContactLink = 'sforce.one.navigateToUrl(/{!$label.report1}?pv0={!Engagement__c.Id})';
    }
        </script>
    <apex:pageBlock >
        
            <table  class="list" border="1" cellpadding="0" cellspacing="0" >
                <thead class="rich-table-thead">
                <tr class="headerRow">
                    <th>Deal Progress</th> 
                    <th>Financial</th>
                    <th>Strategic</th>
                    <th>Total</th>
                </tr>
                </thead>
                <!--The following builds the dashboard table using fields from the Engagement.  The first cell of each row is a hard coded label that links to 
                a specified report for that row. Labels are used to store the individual report SFIDs and they can be edited in Salesforce by going to 
                Setup -> Create -> Custom Labels.  The !ROUND function is being used to display the numbers as whole Integers. -->
                <tr class="dataRow"  >
                    <td class="dataCell" colspan="1"><span><a href="initialContactLink">Initial Contact</a></span></td> 
                    <td class="dataCell" colspan="1"><span>{!ROUND(Engagement__c.Financial_Initial_Contact__c,0)}</span></td>
                    <td class="dataCell" colspan="1"><span>{!ROUND(Engagement__c.Strategic_Initial_Contact__c,0)}</span></td>
                    <td class="dataCell" colspan="1"><span>{!ROUND(Engagement__c.Financial_Initial_Contact__c + Engagement__c.Strategic_Initial_Contact__c,0)}</span></td>
                </tr>
                <tr class="dataRow">
                    <td class="dataCell" colspan="1"><span><a href="/{!$label.report1}?pv0={!Engagement__c.Id}" target="_blank">Marketing Materials Sent</a> </span> </td> 
                    <td class="dataCell" colspan="1"><span>{!ROUND(Engagement__c.Financial_Marketing_Materials_Sent__c, 0)}</span></td>
                    <td class="dataCell" colspan="1"><span>{!ROUND(Engagement__c.Strategic_Marketing_Material_Sent__c,0)}</span></td>
                    <td class="dataCell" colspan="1"><span>{!ROUND(Engagement__c.Strategic_Marketing_Material_Sent__c + Engagement__c.Financial_Marketing_Materials_Sent__c,0)}</span></td>
                </tr>

 
Heather Palosaari 12Heather Palosaari 12
UPDATE:  I created a function for each link to determine whether or not it is in SF1 or the browser, then changed the link to a button.  This allows for different behavior, however sforce.one.navigateToUrl("/{!$label.report1}?pv0={!Engagement__c.Id}") takes me to the report in the app but does not pass the engagment Id parameter.  Any thoughts?