//Info: HL-174 We encountered a scenario in which we had to save the errors generated to the file cabinet as a CSV file and then attach this file to the specific email id provided.
Category: Suite scripts samples
All the samples related to suite scripts.
How to fix ‘Syntax error: missing ; before statement’ for suitescript documents version 2.0 and below
Suitescripts written in version 2.0 or below shows this error ‘Syntax error: missing ; before statement’ even when there is ‘;’ present after every single line of code. For example check this client script sample code in suitescript v2.0.(This is a sample code and not used for any specific purpose) /** *@NApiVersion 2.0 *@NScriptType ClientScript… Continue reading How to fix ‘Syntax error: missing ; before statement’ for suitescript documents version 2.0 and below
Change Tracking number value from Package sublist in IF record
//Info: HL-140 Changing Sublist fields does not always operate as expected in some circumstances.One example is updating the tracking number in the Item Fulfillment record. Along with the regular rec.setCurrentSublistValue, we must include rec.selectLine and rec.commitLine routines as this field change dynamically.
Adding Freezing Header for Sales Orders
Scenario: Sales Orders have item sublist Table, which lists items in each SO. If the number of items becomes too large, we need to scroll the table down, which will also scrolls the table header too. Make this table header freeze and make other details scrollable. Solution: It needs a User Event script. In it’s… Continue reading Adding Freezing Header for Sales Orders
How to generate Basic authentication headers for REST API in suitescript?
REST API supports only ‘Basic authentication’ and ‘OAuth 1.0a’ authentication methods.We can generate Basic authentication headers for REST API requests in suitescript using suitescript modules from the username and API token(password).Authentication header need to be passed as header with every request that require authentication. If we use Postman software we can see an authentication header… Continue reading How to generate Basic authentication headers for REST API in suitescript?
Mandatory Filters to be added while updating an IF Record
//Info: HL-139 There are chances to have multiple Item Fulfillment records with the same internal id but hold some values differently.In order to make it more clear, it’s better to add these filters to the search criteria.
Using relative path for file.load() function
To open a file in a suitescript we can use file.load() function.e.g:var fileObj = file.load({id: ‘Images/myImageFile.jpg’});fileObj.description = ‘my test file’;var fileId = fileObj.save();The id field takes the path to the file like shown in the above example or internal of the exact file. See this example:var fileObj = file.load({id: 123});fileObj.description = ‘my test file’;var fileId… Continue reading Using relative path for file.load() function
Checking Test scenarios for Usage Limit Exceeded cases.
Info: HTN-104 As we know, the governance limit for Schedule script is 10000 & crossing this will result in execution failure.Normally, we reschedule scripts to overcome these conditions. But what about in the case where we perform loops that search huge records & update based on the given range. Example situation: Consider 150 customers are… Continue reading Checking Test scenarios for Usage Limit Exceeded cases.
Adding Loading symbol while processing
Scenario: When some process is processing if you need to show any kind of loading symbol for representing the process may take some time. For this you need to add a loading symbol on the page Solution: For this you need to add a jQuery section with a HTML code block. The HTML code block… Continue reading Adding Loading symbol while processing