4

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

2 Answers 2

3

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.

9
  • Thank you Keith; I never thought of this - I had long forgotten the site xx is requesting access to your Google ... message. Case has been filed. If SFDC is going to offer Google Docs as a feature that automatically gets added to the Note & Attachments related list, then it ought to appear as part of VF pages as well (or they should provide a way/doc to associate the VF domain to the Google account permissions). Would this be controllable at the Google Docs admin level? (I'm not our company Google Docs admin but I know the guy who knows the guy ...)
    – cropredy
    Commented Mar 23, 2014 at 4:25
  • @crop1645 I had a quick look at the Google side but only saw a button to remove existing access not grant new access. Perhaps the setup process requires a handshakes from both sides, though I have manually setup domains in OAUTH UI before - not sure why this is different. Yep definitely see what your guy advises.
    – Keith C
    Commented Mar 23, 2014 at 10:50
  • Keith -- SFDC Dev support responded with the following: "Other customers have reported the same issue and tickets were closed with 'working as designed'; feature to be supported in (unspecified) release." My support rep indicated that he would continue to look for a workaround and/or await Tier 3 to respond with workaround/working-as-designed response. I will code up some jQuery to remove the buttons on VF pages (note that 'add existing Google Doc' button works fine - just not 'New' Google Doc). Disappointing. I voted down the Help page (with comment) as this limitation is not mentioned.
    – cropredy
    Commented Mar 24, 2014 at 23:45
  • @crop1645 I've learned to set my expectations very low when reporting things I consider bugs. Probably a problem shared by all closed source products.
    – Keith C
    Commented Mar 25, 2014 at 0:10
  • 1
    SFDC ack'd today that this is a known issue: success.salesforce.com/issues_view?id=a1p30000000T3q6. Third 'Known Issue' discovered by me in last 12 months - I should get a prize :-)
    – cropredy
    Commented Apr 17, 2014 at 23:03
0

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.

1
  • Welcome to the community! When you answer a question try to read the entire question and answer to the point :)
    – highfive
    Commented Apr 18, 2014 at 3:34

You must log in to answer this question.

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