logging request and response while using netsuite suitetalk - netsuite

is it possible to print/log the request response while using the Netsuite API, is there any property we need to set in the nsclient.properties file that might help.
I am trying to find this so that while integrating with NetSuite, in case of any issues, I don't have to go check the API request/response logs in NetSuite.
regards,
Moin

Requests and responses are logged within NetSuite itself. You need to have the Admin role to see them.

I don't think so. I'm not pretty sure that there is any inbuilt feature in NetSuite that allows you to log the request and response of your deployed Restlet. In Netsuite there is a method called :
nlapiLogExecution(logType, title, details)
Which you can use for temporal logging/Debugging. However, it doesn't persist your logging data permanently, so you can't use the same later. Yeah, Of-course you can find many workarounds to get your task done. Create a custom record with appropriate fields for logging then inside your restlet you can write the code to create a log file for each req/resp.

Related

Clear complete Table for custom entity via App?

Is it possible to clear the complete table via an App through the API for a custom entity?
I tried a DELETE but get an error message: Method Not Allowed (Allow: GET, POST)
The documentation states, that its not needed to set the permission in the xml for the own entity. And I can see that also the delete permission is set when looking at the permissions from the App.
How can I achieve this?
Thanks,
Danny
You can use the sync endpoint to mass-delete records but you will still need the ids for all the records to be deleted. There is no way to truncate a table via the api if that is what you're looking for.

Create Transfer Order through Restlet in Suitescript 2.x

All,
From a third party application, I am triggering a restlet in 2.x. And that restlet invokes a Map/Reduce script to create Transfer Orders. This is not creating transfer orders and throwing "An unexpected SuiteScript error has occurred". It looks the error is occurred due to the role I used. I tried internally through AJAX requests and find the script is working and creates Transfer Order records. So I understand the issue is due to role which the restlet uses. Can anyone help me, which specific permission I needed to add to the roles to create transfer orders?
Thanks in advance!
Babin

Trigger the before/after Submit Scripts through External record create API

External system(SharePoint) is making SOAP API call to create a record in Netsuite, on which creation of records upon meeting a field criteria a beforesubmit script should be triggered in updating field values. When a record is created through Netsuite UI the beforesubmit runs fine but when it is getting created through API call seems like workflow is not running.
So is it something like we cannot invoke Workflow/beforeSubmit process in sfdc through external API call? If so what thinigs should be done to trigger Workflow/beforeSubmit process through external SOAP API calls?
There is a system level preference for this.
Setup > Integration > SOAP Web Services Preferences
check "Run Server Suitescript and Trigger Workflows"
It's off by default.
The preference can also be managed on a request basis.
e.g. by adding the following to the Preferences element in the SOAP Headers
<runServerSuiteScriptAndTriggerWorkflows>true</runServerSuiteScriptAndTriggerWorkflows>
Have you looked at the Context filtering of the userEvent script that do the beforesubmit?

Prismic Integration Field: Not possible to receive Shopify product metafields

I cannot fetch Shopify product metafields using Prismic Integration field via GraphQL API.
What I did:
Created a document with Integration field https://prnt.sc/11dima8
Tried to fetch the product data via GraphQL API, but product metafields are missed https://prnt.sc/11dinv1
What did I check:
The metafields can be found via Shopify GraohQL https://prnt.sc/11akxvp
Data is synced https://prnt.sc/11diq30
How can I retrieve product metafields from Shopify using Prismic Integration field? Does somebody have the same scenario? Probably some extra configurations should be done, but I'm not aware about them.
Thanks in advance!
I don't think that question is relevant anymore as only Prismic team knows about this issue, here is the topic on Prismic forum: https://community.prismic.io/t/integration-field-not-possible-to-receive-shopify-product-metafields/
Well, in fact, fetching Metadata from Shopify requires making an extra call to Shopify API that makes their API time out on the response size.
One temporary solution that we can provide for the moment is to add a link to your metadata, and you fetch them after on your side.
Having a micro-service to fetch all the data works as well, but you have to use a queue system so that if any item fails to sync due to a timeout, for example, you try several times to get it.
Also, you need to manage the authentication with Shopify API on your own.

Implementing logging and retry mechanism in netsuite suitescripts

I am in need of a way to implement the error logging and providing a way to the admins to rtry any failure that occurs within a suitescript.
Here are my thoughts on the implementation:
Lets say for restlet i can log the datain, or the incoming data in any userevent script in a text file along with its status as success or failure. Later have a scheduled script to process that text file that may send those errors to my .Net Api and I can provide a way for Admins to retry.
Could anyone suggest me how its normally done in netsuite projects?
For similar systems, I typically advise you create Custom Records. Your custom records can have a field to store the raw data (JSON, xml, etc) as well as a Status (Succeeded, Failed, Retry, etc). You could consider retry mechanisms like having a User Event on the Custom Record that immediately retries upon creation of the record, then if that fails have a Map/Reduce that runs on a regular schedule to clean things up.
If the native Execution Logs aren't providing enough functionality for you in that respect, you can add a Custom Record for "logging" as well, but I'd suggest trying to use the native logs first. The Script Execution Logs UI provides reasonable searching/filtering capabilities.

Resources