How to get Context Values in Suite Script 2.0? Context APIs In SuiteScript2.0?
Hi All,
Please use below code to get Context API in SuiteScript2.0:
In SuiteScript1.0:
nlapiGetContext()
In SuiteScript2.0:
If script contact is needed like parameter etc
runtime.Script
IfSession context is needed:
runtime.Session
If User Ccntext is needed:
runtime.User
Module Used:
N/runtime Module
Please comment if you have any question.
Thanks
Abhi
Please use below code to get Context API in SuiteScript2.0:
In SuiteScript1.0:
nlapiGetContext()
In SuiteScript2.0:
If script contact is needed like parameter etc
runtime.Script
IfSession context is needed:
runtime.Session
If User Ccntext is needed:
runtime.User
Module Used:
N/runtime Module
Please comment if you have any question.
Thanks
Abhi
Hi Abhi,
ReplyDeleteThank you for spending time to provide important info on NetSuite.
I have one question related to API 2.0
I have created one suitelet with some fields and sublist in "GET" method. I am able to access fields in "POST" method using below code.
var test = context.request.parameters.test1;
But i am not able to get sublist or sublist values in POST method. If you have any idea please help.
Thank you in advance
Hi Suri,
ReplyDeleteBest way to get Line Item Values in SuiteScript2.0 is using N/http Module,
Steps are same as 1.0 ,
get Line Count , if line count comes greater that 0 then get data line by line.
I hope below code will help, you have to include N/http module and parameter(here it is serverRequest) and then use below api:
Step 1:
store some where in your variable
serverRequest.getLineCount({
group: 'sublistId'
});
sublistId is internalid of sublist which you created in GET Request.
Step2:
this will run till end of loop.
serverRequest.getSublistValue({
group: 'item',
name: 'amount',
line: '1'
});
here '1' should be replaced with variable which you define in loop.
Please comment if this will help you.
or if still not working share small working code with me and I will try to solve .
Thanks
Abhi