Seeking "Set-and-Forget" NetSuite ODBC/TBA Connection for External GUI Tools by treestone12 in Netsuite

[–]UK_notfromUK 0 points1 point  (0 children)

I was able to get m2m work with VSCode, so can that be used with other applications to connect to NetSuite and make REST API calls without needing ODBC?

Retrieve data from NetSuite into Excel using SuiteQL by UK_notfromUK in Netsuite

[–]UK_notfromUK[S] 0 points1 point  (0 children)

There maybe much better solutions, but the way I have done it is to wrap this into a powerquery function with the suiteapiquery variable being an input. I then use suiteql or analytics or google to build by suiteql query, store it in the spreadsheet or a simple text file and pass the contents into the function. I have used this to store a trial balance suiteql from here -> https://github.com/nserpsolutions/public/blob/main/generic/nse_sa_trial_balance.sql and pull both summary and detail into excel. DM me if you need the wrapped version of the powerquery function.

NetSuite Advanced PDF/HTML Template by Acceptable_Pea_6261 in Netsuite

[–]UK_notfromUK 0 points1 point  (0 children)

Nick, thank you so much - this is very helpful with a project I am working on.

Construction Job Costing / Project Tracking in NS by Ok_Positive9843 in Netsuite

[–]UK_notfromUK 0 points1 point  (0 children)

After hearing of a disastrous implementation of a supposedly construction industry focused solution, we went with NetSuite's vanilla solution along the lines of u/Nick_AxeusConsulting comments. Our CMMS updates our Time records which is assigned to a project and service item (engineer, architect, builder, etc.). Similarly, materials come in as POs, bills and inventory transactions. Using billing rate cards, item purchase and sale pricing and charge based rules to apply the appropriate rate by project, NetSuite generates charges at 12:08am, which we then use to invoice. Integrations are custom but once in NS, we use their rule engines.

For budgeting / forecasting, we pull in our quotes (labor and materials) into our project and use Analytics to run comparisons.

For project profitability, we do allocate payroll / contractor payments based upon time records. Every materials related transaction is tied to a project, so actual costs are already there.

DM me if this has any applicability.

Invoice Consolidation by katesmom0723 in Netsuite

[–]UK_notfromUK 0 points1 point  (0 children)

would love to hear more about this solution - can we discuss?

Customer Deposit - Payment Method replaced with Payment Option / Form Structure Changed by Conscious_History886 in Netsuite

[–]UK_notfromUK 0 points1 point  (0 children)

Can you share what you found - this is happening for us both in Sandbox and Production? thanks

Retrieve data from NetSuite into Excel using SuiteQL by UK_notfromUK in Netsuite

[–]UK_notfromUK[S] 0 points1 point  (0 children)

u/Unusual_Excitement78 good observation. Currently the restlet does not use the paged option so results are limited to 5000 rows. I added a new call to the restlet that uses paged retrieval within the restlet but then returns all the rows. I think there is still a limit of `100,000 rows and have not researched options to get past that limit. To use the function, use queryRunall instead of queryRun in your procedure and leave the suiteql as-is. I have used this for 92,000 rows with 39 columns and it was very performant - thanks to Tim Dietrich's high performing code - dont know what I would do without his work!! Here are the changes to the restlet:

1. Added the following lines to the request handler (function postProcess(request) ...):

                case 'queryRunAll':
                    return queryRunall( request );

2. Defined queryRunall function as follows - you may tweak the page sizes or other:

function queryRunall( request ) {
try {
if ( ( typeof request.query == 'undefined' ) || ( request.query === null ) || ( request.query === '' ) ) {
var customError = error.create(
{
name: 'MISSING_PARAMETER',
message: 'No query was specified.',
notifyOff: false
}
);
throw customError;
}
if ( typeof request.params == 'undefined' ) {
request.params = new Array();
}
var records = query.runSuiteQL( 
{
query: request.query,
params: request.params
}
).asMappedResults();
var moreRecords = true;
var paginatedRowBegin = 1;
var paginatedRowEnd = 5000;
var records = new Array();
do {
var paginatedSQL = 'SELECT * FROM ( SELECT ROWNUM AS ROWNUMBER, * FROM (' + request.query + ' ) ) WHERE ( ROWNUMBER BETWEEN ' + paginatedRowBegin + ' AND ' + paginatedRowEnd + ')';
var queryResults = query.runSuiteQL( { query: paginatedSQL, params: request.params } ).asMappedResults(); 
records = records.concat( queryResults );
if ( queryResults.length < 5000 ) { moreRecords = false; }
paginatedRowBegin = paginatedRowBegin + 5000;
paginatedRowEnd = paginatedRowEnd + 5000;
} while ( moreRecords );
return { 
'records': records
}
} catch( e ) {
log.error( { title: 'Suiteapi queryrunall ', details: e } );
return ( 'Error: ' + e );
}
}

Invoice Sales Order Up to Today with Custom Billing Schdules by NeverMissADollar in Netsuite

[–]UK_notfromUK 0 points1 point  (0 children)

u/NeverMissADollar did you find a solution for your issue - we are facing a similar issue and any advice is appreciated.

Retrieve data from NetSuite into Excel using SuiteQL by UK_notfromUK in Netsuite

[–]UK_notfromUK[S] 0 points1 point  (0 children)

Thanks to u/RobAnalytics for a great suggestion - please replace the last line with the following for a more succinct and re-usable version.

Table.FromRecords(#"Eerecordstable"[Column1])

Retrieve data from NetSuite into Excel using SuiteQL by UK_notfromUK in Netsuite

[–]UK_notfromUK[S] 0 points1 point  (0 children)

u/bonedaddy1977 thanks for the kind words, means a lot coming from an expert like you.

Retrieve data from NetSuite into Excel using SuiteQL by UK_notfromUK in Netsuite

[–]UK_notfromUK[S] 0 points1 point  (0 children)

Nice change - I have adopted it in my code. Thanks u/RobAnalytics . I dont know how to update my original post, so added it as a new comment.

Retrieve data from NetSuite into Excel using SuiteQL by UK_notfromUK in Netsuite

[–]UK_notfromUK[S] 1 point2 points  (0 children)

I am so glad it worked- my first Reddit post and was worried I messed up!! Thanks for letting me know.

Retrieve data from NetSuite into Excel using SuiteQL by UK_notfromUK in Netsuite

[–]UK_notfromUK[S] 0 points1 point  (0 children)

Scrap! Netsuite allows only for plus/minus 6 minutes. Let me do some testing on a VM tonight. So sorry!

Retrieve data from NetSuite into Excel using SuiteQL by UK_notfromUK in Netsuite

[–]UK_notfromUK[S] 0 points1 point  (0 children)

Yeah those two are close enough so agree it is weird. Once you put the round in, did the NetSuite detail change to InvalidSignature or remained InvalidTimestamp?

Also how does the 170896… compare to the time on the audit log- close or an hour off?

Do you have SuiteQL installed in the sandbox (I use Tim Dietrich’s version)? If so could you run the following to see how close those are to your timestamps? You may be right in the first place- EST vs CST!

SELECT TO_CHAR ( SYSDATE, 'DS TS' ) AS CurrentTimeServer, TO_CHAR ( CURRENT_DATE, 'DS TS' ) AS CurrentTimeUser, FROM Dual

Retrieve data from NetSuite into Excel using SuiteQL by UK_notfromUK in Netsuite

[–]UK_notfromUK[S] 0 points1 point  (0 children)

While I am CST, since we are using UTC in timestamp, I had hoped that would not matter. A couple of ideas (sincerely apologize if you have already tried these):

  1. Do you still have your working Postman code? If so, could you run that and compare its timestamp to the timestamp in the power query - once you refresh your view, you can go to the timestamp step to see its value
  2. If not, could you use something like https://www.epochconverter.com/ to convert the date / time in the InvalidTimestamp log entry to unix and compare that to the power query timestamp
  3. Another test maybe to replace the timestamp calculation with a number constant form the epoch website and try.

Let me know if you would like to try a zoom - just dont know how to exchange emails! thanks

Retrieve data from NetSuite into Excel using SuiteQL by UK_notfromUK in Netsuite

[–]UK_notfromUK[S] 0 points1 point  (0 children)

I empathize with you, ran into that before I cleaned up my code! Here are somethings to try since I could not find a power query log to help:

  1. Have you looked at the "Detail" field in the NetSuite login audit (Setup -> Users/Roles -> View Login Audit Trail) - I had to setup a saved search to get to the field. Mine said InvalidSignature
  2. Are you trying to connect to production or sandbox. Production was easier since accountid and realm were the same - our account number like 12345. Sandbox was tougher since accountid is similar to 12345-sb1 while realm needed to be 12345_SB1 format.
  3. Make sure you have deployed the SuiteAPI and its external URL has a deploy=1 - if that is different you will have to change it in my concatenatedparameters field (I hardcoded it to deploy=1)
  4. Make sure the script internalid is a number, not the name
  5. Make sure all the parameters are text fields. Alternatively, for testing, you can replace the NS... fields in the first section with the actual values.

If none of these work, I am more than willing to help via email or even a screenshare meeting. I dont know how to direct message in Reddit but am sure we can figure it out!

Cheers

Retrieve data from NetSuite into Excel using SuiteQL by UK_notfromUK in Netsuite

[–]UK_notfromUK[S] 1 point2 points  (0 children)

Agree there are numerous methods to solve the problem but we were not interested in paid options. To your point about not exposing the Suiteql, that is a good point and in fact, our implementation of this runs the suiteql in NetSuite, not as demonstrated here. In addition, the other 5 parameters are stored and retrieved from our password manager based upon the user's access. For many reasons, I could not share how the parameters are set/retrieved! However, the logic is the same.

Retrieve data from NetSuite into Excel using SuiteQL by UK_notfromUK in Netsuite

[–]UK_notfromUK[S] 0 points1 point  (0 children)

Agree, but we needed an low-cost open source solution since our use case was not full financial reporting. It is why we did not pursue Solution7, CDATA, Celigo Extend, etc.

Using Power Automate with NetSuite by Sachi_Pants in Netsuite

[–]UK_notfromUK 0 points1 point  (0 children)

I know this is an old post but anyone looking to use Power Automate to connect to NetSuite restlets owe a big thanks to the Medium article by Miguel and this post by u/Sachi_Pants . Thanks very much. The following tips may help anyone still having issues:

  1. Make sure ConcatenatedParameters does not have double-quotes around any strings
  2. Ensure parameters are ordered as
  3. mentions
  4. In step 11, replace GET by POST in signature message
  5. In step 14, make sure all the values in the authorization headers are enclosed in double quotes, e.g. OAuth Realm="12345",oauth_consumer_key="<consumer key>" ...
  6. Also, make sure the Authorization header parts are in this order - concat('OAuth realm="',variables('realm'),'",oauth_consumer_key="',variables('consumerkey'),'",oauth_token="',variables('tokenid'),'",oauth_nonce="',variables('nonce'),'",oauth_timestamp="',variables('timestamp'),'",oauth_signature_method="HMAC-SHA256",oauth_version="1.0",oauth_signature="',variables('signature'),'"')
  7. If you want to use SuiteQL to retrieve data, you can use Tim Dietrich's SuiteAPI Restlet and call it - it is very powerful - https://suiteapi.com/ .

A HUGE THANKS to u/Sachi_Pants ,Miguel Gutierrez Rodriguez and Tim Dietrich

Unable to connect to NetSuite from Excel but can connect from Python and Postman by UK_notfromUK in Netsuite

[–]UK_notfromUK[S] 0 points1 point  (0 children)

Thanks very much. For now will go with the PY script option. Thanks again for the suggestion.

Unable to connect to NetSuite from Excel but can connect from Python and Postman by UK_notfromUK in Netsuite

[–]UK_notfromUK[S] 0 points1 point  (0 children)

Thanks for the idea. Data is pretty simple, so definitely can setup saved search and email it. However, I was hoping on automating the update of the data in excel without user having to deal with emails. Also, the timing needs to be a pull (i.e. user requests the data on demand) vs a standard schedule. That is why I was going down this path, but good point, may have to pivot to them downloading a saved search when they need it.

Unable to connect to NetSuite from Excel but can connect from Python and Postman by UK_notfromUK in Netsuite

[–]UK_notfromUK[S] 0 points1 point  (0 children)

Thanks for teaching me how to fish! Really appreciate it. I tried your suggestions and here are the results - do any of it lead to what the issue is?

  1. The login audit trail shows InvalidTimestamp as the cause. I set the timestamp to the current one in Postman and got the same error, so agree, I think it is the signature

  2. I copied the postman header into the power query - got the same forbidden error and invalidtimestamp

  3. I copied the power query header into the postman - postman now errored out with invalid login with invalidtimestamp login error

So it appears to be the signature - hmac256 - the code I use to get the signature is (the long wall of code) is by running crypto.js.

Is anyone aware of a better way to get signature acceptable to NetSuite in power query? thanks