Last active
October 15, 2021 09:42
-
-
Save axilaris/1fdbfa6f2de3134c3b08b7492b0ddc81 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * @NApiVersion 2.1 | |
| * @NScriptType Restlet | |
| */ | |
| define([ | |
| "N/log", | |
| "N/search", | |
| ], function (log, search) { | |
| function post(context) { | |
| return JSON.stringify(getCustomRecords(context)); | |
| } | |
| function getCustomRecords(context) { | |
| log.debug('POST Context', context); | |
| return search.lookupFields({ | |
| //Change CUSTOM_RECORD to the type of custom record you are querying | |
| type: search.Type.MYENTRY, | |
| id: context.id, | |
| columns: context.fields, | |
| }); | |
| } | |
| return { | |
| post: post, | |
| }; | |
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ... | |
| payload = { | |
| "id":"1", | |
| "fields": ["ID", "EMPLOYEENUMBER"], | |
| } | |
| ... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Result: {"error" : {"code" : "SSS_MISSING_REQD_ARGUMENT", "message" : "{"type":"error.SuiteScriptError","name":"SSS_MISSING_REQD_ARGUMENT","message":"search.lookupFields: Missing a required argument: type","stack":["Error"," at getCustomRecords (/SuiteScripts/myentryRESTLET.js:17:23)"," at Object.post (/SuiteScripts/myentryRESTLET.js:12:31)"],"cause":{"name":"SSS_MISSING_REQD_ARGUMENT","message":"search.lookupFields: Missing a required argument: type"},"id":"","notifyOff":false,"userFacing":true}"}}
{'X-N-OperationId': 'f895eead-3787-415a-9c8c-d9f9c01e85f4', 'NS_RTIMER_COMPOSITE': '1131023295:706172746E6572733031312E70726F642E6475622E6E65746C65646765722E636F6D:80', 'Strict-Transport-Security': 'max-age=31536000', 'Content-Type': 'application/json;charset=utf-8', 'Pragma': 'No-Cache', 'Cache-Control': 'No-Cache', 'Expires': '0', 'Content-Length': '548', 'P3P': 'CP="CAO PSAa OUR BUS PUR"', 'Vary': 'User-Agent', 'Date': 'Fri, 15 Oct 2021 06:07:46 GMT', 'Connection': 'close', 'Set-Cookie': 'NS_ROUTING_VERSION=LAGGING; path=/', 'Akamai-GRN': '0.9eeece17.1634278066.48907993'}