SuiteScript Exceeded Data Units - netsuite

I am using SS 1 and a Suitelet to load a list of associated assembly items and then, the user checks which ones to mod. I mod them but I am running up against that limitation of script usage. Well I offloaded this to a restlet and I did the user auth for the Authorization (username password) now I am getting an
"INVALID_HOST", "message" : "Invalid host debugger.sandbox.netsuite.c" message in the response from 'nlapiRequestURL' I am calling the script from a Suitelet, how can it be an invalid host? Any help would be great, thanks

Need more info to solve the Invalid Host issue, could be caused by something in the code as I noticed the url is incomplete, if you paste it I could be able to help you further.
Taking a step back to what you are actually trying to achieve you can proceed in two ways:
1: Process the user input immediately. (The user would have to wait until the process ends)
2: Schedule a batch job. (This is the recommended option for large operations)
If you decide to go with option 1(Process Immediately) then I suggest setting up a clientside function attached to a button on the form. Additionally you would need to accept POST request in your Suitelet to receive the data and process it. Your clientside function would process the items in a loop and would pass each item to the Suitelet for processing using ajax calls (Dont use nlapiRequestURL as it would use governance points). If you want to get fancy you can even add a callback function to your ajax call and display a progress bar so every time one of the records is processed by the Suitelet your progress bar would be updated and at 100% show as "Complete".
If you go for option 2 (Schedule a batch job) then you can pass the data as a parameter to a Scheduled Script using nlapiScheduleScript(scriptId, deployId, params), process the data in a loop and have it send an email to the user at the end. Preferably you would want to use a Map Reduce script but that's on SS 2.0.

Related

How to perform backward pagination in cognito userpool

I am working with nodeJs - AWS lambda function, cognito userpool(AWS).
The requirement is of adding pagination feature, for that I am able to perform forward pagination with the help of https://docs.aws.amazon.com/cognito-user-identity-pools/latest/APIReference/API_ListUsers.html,
but I am not able to find, what are the necessary steps to perform backward pagination, so that in UI, the users can scroll to previous and next pages without any issues using the endpoint created by me.
Can anyone help me into this?
Since you are directly accessing cognito API to do pagination for users,
What I would suggest is to pass a paginator value from UI to your API, that API will process your pagination in a loop,
For Example:
For the ease of understanding I will use pagination from 1
and each page is having 8 items,
So let's say,
You are sending querystringparameters something like this:
[your-api-endpoint]?page=1
Now, there is a variable counter which is the number of times your loop will execute,
Start a loop and in that loop call the Cognito API along with token handling capability, so if you call it 1 time you will have first 8 items.
Now let's take another scenario:
You are sending querystringparameters something like this:
[your-api-endpoint]?page=2
Now, the variable counter which is the number of times your loop will execute is set to 2,
Start a loop and in that loop call the Cognito API along with token handling capability, so if you call it you will have first 8 items, and loop will execute one more time since counter is set to 2, therefore you will have next 8 items and you can return that.
In this way your pagination will depend on input from front-end.
Since, I cannot found any specific sdk or code to implement backward pagination in cognito user pool, I have taken help of front end to store the pagination token sent from backend and fetch data accordingly.
So the scenario will be : For first time calling the API, the pagination token value(in headers/or the place where it is kept(params/body/headers)) will be NULL, and response will get a paginationtoken to move to next page, it can be stored in UI code, and use it to move to next page, again response will receive a paginationtoken, store it and proceed further to fetch next page data.
In order to move back to the previous page, use the stored pagination token and fetch the details accordingly.

How to store Body data in post request through jmeter

I am new to jmeter, I am using jmeter to test e-commerce website.
I have manage to script one scenario, which is to add a product in basket and test the response time.
Now, I have observed that when i click Add button on UI, their are two requests which are getting POSTED.
for eg: stocks are updated.
As of now, I have copied the BODY from stock and pasted in jmeter sampler, but in future i may change the Sales order and update scenario, hence i want to store this Body data(Stock request which is updated) of this request dynamically, as it will change corresponding to sales order number im providing.
The problem is I am not able to store the BODY data dynamically(Only if i change the sales order here).
I know i can use pre processor in this matter, but could anyone help me with the code to get the BODY data from the request and store dynamically before sending the sample.
Basically I need a solution where I am just updating my sales order number and rest of the things will be taken care dynamically, in my case the POSTING of Body data for updating the STOCK.
Thank you in advance!
See basically, you're talking about Correlation. As I can understand from your concern. You need the data for the product added to the cart. Which needs data from prev request. This can be easily managed by generating two requests. Extracting from first and using that info for the second one. This will not involve any hardcoding and will work for you in an efficient manner.
Something like:
vars.put('bodyData', sampler.getQueryString())
should do the trick for you, if you put this code into a JSR223 PreProcessor and add this PreProcessor as a child of the HTTP Request sampler which body you need to store - you will be able to access the request body as ${bodyData} later on where required
In the above example:
vars - stands for JMeterVariables class instance
sampler - is for HTTPSamplerProxy
More information: Top 8 JMeter Java Classes You Should Be Using with Groovy

Display a user friendly message in user event script

I'm trying to do some validations using a user event script but I want to show user some meaningful error instead of the default 'suitescript' error at the end. Is there any way to do this?
User Events are server-side, so there is no UI in which to display a message. You cannot validate date on beforeSubmit and display a message. If you want to validate as the user saves and show them feedback, you need to use the saveRecord entry point on a Client Script.
You can do this via the beforeLoad entry point because it receives a reference to the Form in context, which has an addPageInitMessage entry. Check out the Help docs for this method to see if it will work for your case.
As #erictgrubaugh suggested you cannot use User Event for validation.
If you want to perform validation and stop form submission, you need to use ClientScript with saveRecord and you can perform all of your validations here. If current record does not passes your validation you show user error using N/ui/message with some description and if everything is correct return true.
To stop current record from being saved, return false from saveRecord.
Check this out to see how to use N/ui/message and this for further reading on saveRecord.
You can use "throw" to display error message on before submit.

REST API - execute multiple actions

Currently trying to work out how to use REST API to execute an action.
I added the ReverseInvoice action from Bills screen on my endpoints. And seems execute fine. Unfortunately, executing an action does not return a result e.g. 204 No Content. I'd wish to extract the RefNbr of the Debit Adj. raised.
Second problem is how do you stack actions or call series of actions ? The raised Debit Adj is not Released. So it seems ReverseInvoice & Release need to be executed at the same time. Plus, I also need them to be allocated against each other automatically.
I've got a feeling the REST API is not the way to go with this one.
Cheers and thanks for responses.
Unfortunately, you're correct on both points: Acumatica's Contract-based API (both SOAP and REST flavors) doesn't allow you to get the entity that is a result of an action (you can only get the status of action invocation), and if you want to chain a sequence of action you'll have to do that manually from the client (call one action, check for the status, call the second one, check, raise, rinse, repeat). Or you can write a customization with a custom action that call two actions in sequence, and call that from the API.

Calling a method according to a timer set by the user

I am working on a JSF application that connects with Twitter.
In one of my views, I have a button that when clicked, calls a method that connects with a Twitter account retrieving new tweets and doing some processing on them.
Next to the button I want to let the user to set a timer in order that this action is done automatically. For example if the user selects '2minutes', Twitter must be checked every 2 minutes automatically and the results be refreshed.
Can someone help with some general explanations how can I do this?
Take a look at this Poll - Start/Stop
in your case
interval="#{myBean.someIntervalNum}"
and so on...

Resources