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
Nitish TalekarNitish Talekar 

i want to redirect to opp record after clicking on opportunity name in salesforce1 mobile app.

User-added image
i want to redirect to opp record after clicking on opportunity name in salesforce1 mobile app. but getting this error while using sforce.one.navaigateToSobject(id)
Best Answer chosen by Nitish Talekar
Madhanprabhu Thangadurai 1Madhanprabhu Thangadurai 1
Hi Nitish,

Include the following javascript file to your visualforce page.
<script src="/soap/ajax/33.0/connection.js" type="text/javascript"></script>
I have hard-coded the Opportunity Id for my convenient, replace that with your variable. The following code is working for me.
<apex:page showHeader="false" standardController = "Opportunity" >
<script src="/soap/ajax/33.0/connection.js" type="text/javascript"></script>
<script type="text/javascript">
function navigateToDetailPage() {
    if( (typeof sforce.one != 'undefined') && (sforce.one != null) ) {
         sforce.one.navigateToSObject('0069000000NY3Qk','detail');
    }
}
</script>
<apex:form >
<apex:commandLink value="Burlington Textiles Weaving Plant Generator" onclick="navigateToDetailPage();"/>
</apex:form>
</apex:page>
User-added image
User-added image

 

All Answers

sandeep sankhlasandeep sankhla
Hi Nitesh,

Please use below URL to redirect

sforce.one.navigateToSObject(recId,"detail");

there are 2 parameter which you need to pass, Id and Detail..

Please check and let me know if it works for you

P.S. If my answer helps you to solve your problem please mark it as best answer. It will help other to find best answer.

Thanks,
Sandeep
Salesforce Certified Developer 
Nitish TalekarNitish Talekar
Hi Sandeep,
I used the 
sforce.one.navigateToSObject(recId,"detail"); but getting same error.
Madhanprabhu Thangadurai 1Madhanprabhu Thangadurai 1
Hi Nitish,

Include the following javascript file to your visualforce page.
<script src="/soap/ajax/33.0/connection.js" type="text/javascript"></script>
I have hard-coded the Opportunity Id for my convenient, replace that with your variable. The following code is working for me.
<apex:page showHeader="false" standardController = "Opportunity" >
<script src="/soap/ajax/33.0/connection.js" type="text/javascript"></script>
<script type="text/javascript">
function navigateToDetailPage() {
    if( (typeof sforce.one != 'undefined') && (sforce.one != null) ) {
         sforce.one.navigateToSObject('0069000000NY3Qk','detail');
    }
}
</script>
<apex:form >
<apex:commandLink value="Burlington Textiles Weaving Plant Generator" onclick="navigateToDetailPage();"/>
</apex:form>
</apex:page>
User-added image
User-added image

 
This was selected as the best answer
Nitish TalekarNitish Talekar
Thanks Madhanprabhu.its working for me. :)
SAHG-SFDCSAHG-SFDC
Hi,

I want to make one of the column in the VF page clickable and it should redirect to the opportunity product how do I achieve that?

 <apex:column >
             <apex:outputLink value="https:/xxxxxxxxxxsalesforce.com/?id={opportunity.OpportunityLineItems}">{!item.product2.name}</apex:outputLink>
            </apex:column>