Find your content:

Search form

You are here

New Google Doc fails when used in VF page

 
Share

This is related to Add Google Doc button into custom 'notes and attachments' Visualforce component but using 100% native SFDC, no jQuery.

  1. Google Docs enabled
  2. Simple VF page using only apex:detail

     <apex:page standardController="Bar__c">
       <apex:detail inlineEdit="true" relatedList="true"/> 
     </apex:page>
    

Screen shot

When you click New Document, the Google dialog appears as expected: enter image description here

Yet you go one step further and click 'Create Google Doc', SFDC redirects you to the home page!

But, if you eliminate the VF page altogether and use the standard page layout, the sequence works as expected and you are redirected after authentication to a Google Docs page where your 'Foo' document is saved and can be edited.

HTTP traffic - failure use case [VF page] (some lines omitted for irrelevance, url string decoded for readability)

  1. VF requests page: GET /_ui/core/google/docs/GoogleDocAuthenticate/d?denied=/_ui/core/google/docs/GoogleDocDenied/d&next=/_ui/core/google/docs/GoogleDocSuccess/d?method=0&docName=foo%&parentId=a1uK0000001SfoS&docType=DOCUMENT&secret=24900737
  2. Response is redirect to salesforce.com domain: https://cs9.salesforce.com/_ui/core/google/docs/GoogleDocAuthenticate/d?denied=/_ui/core/google/docs/GoogleDocDenied/d&next=/_ui/core/google/docs/GoogleDocSuccess/d?method=0&docName=foo&parentId=a1uK0000001SfoS&docType=DOCUMENT&secret=24900737
  3. salesforce.com requests page: GET /?parentId=a1uK0000001SfoS&docName=foo2&docType=DOCUMENT&next=/_ui/core/google/docs/GoogleDocSuccess/d?method=0&docName=foo&parentId=a1uK0000001SfoS&docType=DOCUMENT&secret=24900737&denied=/_ui/core/google/docs/GoogleDocDenied/d&secret=24900737&method=0&retry=1
  4. Response is redirect back to itself: https://cs9.salesforce.com/?parentId=a1uK0000001SfoS&docName=foo&docType=DOCUMENT&next=/_ui/core/google/docs/GoogleDocSuccess/d?method=0&docName=foo&parentId=a1uK0000001SfoS&docType=DOCUMENT&secret=24900737&denied=/_ui/core/google/docs/GoogleDocDenied/d&secret=24900737&method=0&retry=1
  5. salesforce.com requests page: GET /?parentId=a1uK0000001SfoS&docName=foo&docType=DOCUMENT&next=/_ui/core/google/docs/GoogleDocSuccess/d?method=0&docName=foo&parentId=a1uK0000001SfoS&docType=DOCUMENT&secret=24900737&denied=/_ui/core/google/docs/GoogleDocDenied/d&secret=24900737&method=0&retry=1
  6. Response is redirect to home page: https://cs9.salesforce.com/home/home.jsp?sdtd=1

HTTP traffic - success use case [std layout] (some lines omitted for irrelevance)

  GET   200 text/html   https://cs9.salesforce.com/_ui/core/google/docs/GoogleDocAuthenticate/d?denied=/_ui/core/google/docs/GoogleDocDenied/d&next=/_ui/core/google/docs/GoogleDocSuccess/d?method=0&docName=foo&parentId=a1uK0000001SfoS&docType=DOCUMENT&secret=8569450
  GET   302 Redirect to: https://www.google.com/accounts/ServiceLogin?service=wise&passive=1209600&continue=https://docs.google.com/a/ourdomain.com/document/d/1Ck4ZNYwQLf34opHJUhv1aFB8LdQmiVyvwGlaCeeO2SI/edit?usp=docslist_api&followup=https://docs.google.com/a/ourdomain.com/document/d/1Ck4ZNYwQLf34opHJUhv1aFB8LdQmiVyvwGlaCeeO2SI/edit?usp=docslist_api&authuser=1 

This is very bizarre, if I start on a VF page, VF redirects to the salesforce.com domain but then this page /_ui/core/google/docs/GoogleDocAuthenticate/d never loads, yet if I start on the standard layout, salesforce.com happily and successfully requests page /_ui/core/google/docs/GoogleDocAuthenticate/d which loads and does its thing.

UPDATE 2014-04-17 - SFDC Developer Support has marked as Known Issue - although the wording of the issue isn't very precise


Attribution to: cropredy

Possible Suggestion/Solution #1

I think this relates to the domain that the browser is operating from:

  • na15.salesforce.com - default UI
  • c.na15.visual.force.com - Visualforce page

When you first grant access to Google Docs (starting from the default UI page) you are asked:

The site na15.salesforce.com is requesting access to your Google Account for the product(s) listed below.

and accepting that results in an entry in your Google "Account Permissions" that na15.salescorce.com "Has access to Google Drive".

But this grant process appears to be broken when started from the Visualforce domain (and using the apex:detail) because the request to https://accounts.google.com/AuthSubRequest asks for access for na15.salesforce.com not for c.na15.visual.force.com.

I don't see anything that you can control to work-around this. You could create a case requesting this be fixed, but it is unlikely to get any priority.


Attribution to: Keith C

Possible Suggestion/Solution #2

This issue is a bug and may be fixed by salesforce. Here is the Known Issue link : https://success.salesforce.com/issues_view?id=a1p30000000T3q6

Please click on "This issue affects me" to get updates on the ETA.


Attribution to: nevrekar_amey
This content is remixed from stackoverflow or stackexchange. Please visit https://salesforce.stackexchange.com/questions/30674

My Block Status

My Block Content