Forum Discussion

ushah763's avatar
ushah763
Helper I
7 years ago

DataSource.Error: Web.Contents failed to get contents from Salesforce.com

DataSource.Error: Web.Contents failed to get contents from 'https://acmeinc.my.salesforce.com/services/data/v27.0/query?q=SELECT%20Id%2CIsDeleted%2CMasterRecordId%2CLastName%2CFirstName%2CSalutation%2CName%2CRecordTypeId%2CTitle%2CCompany%2CStreet%2CCity%2CState%2CPostalCode%2CCountry%2CLatitude%2CLongitude%2CPhone%2CMobilePhone%2CFax%2CEmail%2CWebsite%2CDescription%2CLeadSource%2CStatus%2CIndustry%2CRating%2CCurrencyIsoCode%2CAnnualRevenue%2CNumberOfEmployees%2COwnerId%2CHasOptedOutOfEmail%2CIsConverted%...

 

I am trying to connect to the Lead table in Salesforce.com and keep getting this error. This query used to work. I am not sure what changed to prevent it from working.

 

I have tried many solutions on the forum and none seem to work. I also tried connecting via Excel PowerQuery and get the same error, but the query works in Tableau which leads me to think this is related to a Microsoft driver or API into Salesforce.com.

 

Could use some help here.

 

even a preview query produces the error in Power Bi Desktop:

 

12 Replies

  • p.s.

     

    i tried reducing the query to only a few columns, this didn't work:

     

     

    let
    Source = Salesforce.Data("https://acmeinc.my.salesforce.com/", [CreateNavigationProperties=true]),
    Lead = Source{[Name="Lead"]}[Data],
    #"Removed Other Columns" = Table.SelectColumns(#"Filtered Rows",{"Last_Status_Date__c", "Last_Converted_Status_Date__c", "Id", "Lead_Owner_Name__c","Name", "Title", "Lead_Owner_Sub_Territory__c", "Company", "State", "Country", "Phone", "Email", "CreatedDate", "LastActivityDate","Status", "DoNotCall", "Lead_Account_Sales_Program_Type__c", "Account_Type__c","ActivityHistories","LS_Status__c" })

    in
    Lead

  • Im having this exact same issue trying to load a Salesforce object. Did you manage to find the cause of this?

     

    Regards

    Atish

  • Anonymous's avatar
    Anonymous
    Not applicable

    I am having the same problem...did you find a solution?

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi ushah763 

     

    I have the same problem. Did you have a solution?

     

    best regards

    • akhatri's avatar
      akhatri
      Helper I

      Hi Carloshluiz,

       

      Unfortuately no solution was found as it looks like its an error where the individual SFDC object has more columns than the limit of SFDC Connector in Power BI.

       

      The workaround I found it I now use an addin to SFDC called Salesforce Inspector to build my queries for those tables and then copy the columns i've selected in SFDC Inspector over to Power BI.

       

      Hope that helps.

       

      Atish

  • Anonymous's avatar
    Anonymous
    Not applicable

    So after playing around with this for a while here's what I think - 

    This is an issue that you can get around by using the choose columns step after bringing in the SF object. The reason this works is because of query folding in PowerBI - the query that PowerBI sends to SF after you include a remove/choose columns step is small enough to work.

     

    However! If there is anything else in your query that would turn OFF query folding - (for me, this happened when I added a relative date filter), then this solution will no longer work, because now PowerBI is trying to query the full SF object, and then after that comes back apply a choose/remove columns. 

     

    So - the workaround that worked for me, if available to you - put the base query in a PBI dataflow (SF connection and choose columns), then bring in the dataflow to PBI and apply any additional transformation to that. 

     

    Here's a link to more infromation about query folding: https://docs.microsoft.com/en-us/power-query/power-query-folding

     

    Hope this helps.

  • This workaround from the original source (Follow this Link) worked for me, in case anyone is still looking for a solution on this

     

    let
        Source = Salesforce.Data("[salesforce URL]", [CreateNavigationProperties = true]),
        Account1 = Source{[Name="Account"]}[Data],
        Account2 = Table.SelectColumns(Account1, { "First Column", "Second Column" })
    in
        Account2
  • Hi, ushah763 were you able to find a solution? As a workaround, maybe you can try to test your connection with a 3rd party connector. I've tried windsor.ai, supermetrics and funnel.io. I stayed with windsor because it is much cheaper so just to let you know other options. In case you wonder, to make the connection first search for the Salesforce connector in the data sources list:

     

     

    After that, just grant access to your Salesforce account using your credentials, then on preview and destination page you will see a preview of your Salesforce fields:

     

     

    There just select the fields you need. It is also compatible with custom fields and custom objects, so you'll be able to export them through windsor.  Finally, just select PBI as your data destination and finally just copy and paste the url on PBI --> Get Data --> Web --> Paste the url. 

     

  • Hi ushah763 (and ramhariessentia who's hitting the same),

     

    The "Web.Contents failed to get contents" error from that URL pattern is a Salesforce REST API URI length issue - when the auto-generated SELECT query (with all fields) exceeds the API's URL length limit, the request gets rejected before any data comes back. It typically starts happening once your object gets wide enough (new custom fields added, relationships expanded, etc.) - which fits the "used to work" pattern.

     

    The Table.SelectColumns workaround that AzAhm posted can help, but only when Power Query folds the pruning step back into the SOQL sent to Salesforce. If it doesn't fold (depends on connector version and where the step sits in the chain), the error persists.

     

    If you'd rather pick fields visually without depending on M-side folding, Power BI Connector for Salesforce on AppExchange is one alternative:

     

    Why it might fit:

    Happy to set up a quick demo if it'd help. Just reach out via the support link.

     

    Cheers,

    Metrica Team.