Forum Discussion

JinJia's avatar
JinJia
New Member
9 years ago

Integrate PowerBI with Netsuite

Hi, devs

 

I'm currently integrating PowerBI with Netsuite.

 

I'm facing an issue. I want to know the way to get access token with Javascript API.

 

Looking forward to hearing from you asap.

 

Thanks,

Jin

13 Replies

  • Eric_Zhang's avatar
    Eric_Zhang
    Microsoft Employee

    JinJia

     

    You can embeded report with Javascript API, check Embedding Basics. However AFAIK, there's no way to get accesstoken in Javascript, you would have to get the token in backend(eg in C#) and pass it to the page.

    I have no idea on Netsuite and not sure what you can do in it. Maybe ask the question how to integrate an C# app with Netsuite in the dedicated forum.
     

    • JinJia's avatar
      JinJia
      New Member

      Hi, Eric

       

      I'd like to ask you a few more questions.

       

      As I metioned before, I'm integrating PowerBI with Netsuite.

       

      I'd like to import Sales Order reports from NetSuite to PowerBI.

       

      I think, the only way I can do this is to import sales order record one by one.

       

      I tried to use PowerBI REST API before but I can't find solution.

       

      PS: NetSuite only provide Javascript API so integration should be done only by Javascript. So I think C# is not solution.

       

      Can you please give me some reference for it?

       

      Please ask me any questions you might have.

       

      Looking forward to hearing from you asap.

       

      Sincerely,

      Jin

      • Eric_Zhang's avatar
        Eric_Zhang
        Microsoft Employee

        JinJia

        Then my approach would be using Power BI Embedded, check Power BI emebedded VS Rest API.

         

        1. Import the records to powerbi desktop,design the report and upload it to a workspace. Regarding data refreshing, check this link.
        2. Generate an accesstoken that never expires(not recommended).
          var embedToken = PowerBIToken.CreateReportEmbedToken(this.workspaceCollection, this.workspaceId, report.Id,Convert.ToDateTime("2099-12-31"));
        3. Embed the report with PowerBI-Javascript. You can save the below sample in a html file and run in brower, my token in this test wouldn't expire before 2018 year.
           
          <html>

          <script src="https://microsoft.github.io/PowerBI-JavaScript/demo/bower_components/jquery/dist/jquery.js"></script>
          <script src="https://microsoft.github.io/PowerBI-JavaScript/demo/bower_components/powerbi-client/dist/powerbi.js"></script>

          <script type="text/javascript">
          window.onload = function () {

          var embedConfiguration = {
          type: 'report',
          accessToken: 'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ2ZXIiOiIwLjIuMCIsIndjbiI6IndvcmtzcGFjZUNvbGxlY3Rpb240UEJJIiwid2lkIjoiYjVkMDJiYmItODcxNy00MmJlLWEzMTMtZDEyYTdmYzk0OTcyIiwicmlkIjoiMjlhNDcxNGYtYzQzMi00ZjEwLTk5ZTMtNzA1MzhmNGJlYmUwIiwiaXNzIjoiUG93ZXJCSVNESyIsImF1ZCI6Imh0dHBzOi8vYW5hbHlzaXMud2luZG93cy5uZXQvcG93ZXJiaS9hcGkiLCJleHAiOjE1MTQ2NDk2MDAsIm5iZiI6MTQ4MDAyOTQ4Nn0.GC1iQa1Xghkp9o4R87DcRjaLe9a0PBN7wxYOJKFDd5Y',
          id: '29a4714f-c432-4f10-99e3-70538f4bebe0',
          embedUrl: 'https://embedded.powerbi.com/appTokenReportEmbed?reportId=29a4714f-c432-4f10-99e3-70538f4bebe0'
          };

          var $reportContainer = $('#reportContainer');

          var report = powerbi.embed($reportContainer.get(0), embedConfiguration);


          }
          </script>

          <div id="reportContainer"></div>

          </html>
  • sandralynn's avatar
    sandralynn
    Regular Visitor

    Hi JinJia

     

    The ability to connect NetSuite to Power BI is a common, highly requested idea on the Power BI ideas website. As such, there is very little information available regarding how to connect NetSuite to Power BI. Elegant alternative solutions that integrate NetSuite to Power BI by automating data refresh.

     

    1. Purchase the SuiteAnalytics Connect (ODBC) functionality from NetSuite
    2. Leverage NetSuite’s Web Query report functionality

    Thanks.

    • EP_Jack's avatar
      EP_Jack
      Regular Visitor

      If you enable webquery on a saved report, you can then download a .igy file,

       

      open this in a text editor  strip out  everything before htts:\\

       

      and strip out the following from the end

       

      Formatting=All
      PreFormattedTextToColumns=True
      ConsecutiveDelimitersAsOne=True
      SingleBlockTextImport=False

       

      replace 

       

      ["emailaddress","Please enter your email address:"]

       

      with 

       

      [email protected]

       

      then copy the string and go into PBI and got o data sources and use a web data source, paste this in and use an anonmous authentication, and away you go

       

      i've also created a powershell scrip with a smilar function to sync to local MSSQL DB and then you can point PBI to a SQL DB, personal prefernce which way round you want to access your data

      • SQLMonger's avatar
        SQLMonger
        Advocate II

        Would you be willing to share the PowerShell script you create for pulling data from NetSuite?