I'm currently having issues with passing values th...
# suitescript
u
I'm currently having issues with passing values through
https.get()
. I can successfully pass values through it using the
headers
parameter, and accessing them from the redirected HTML through a
URLSearchParams
object. This works great when the suitelet is calling the GET function, but when calling the POST function and running the same steps of passing values through headers, it doesn't make it to the HTML. Does POST follow a different ruleset for passing values or should I pass values differently? Any and all input appreciated, thanks.
so as not to clog up the channel thread, i'm pasting my full script here, with some omissions for brevity
Copy code
/**
   * @NApiVersion 2.1
   * @NScriptType Suitelet
   */
define(['N/https', 'N/record', 'N/email', 'N/search', 'N/log', 'N/url'],
       function callbackFunction(https, record, email, search, log, url) {
  function getFunction(context) {

    let id = 7;
    let usr = 'seven';

    let headerObj = ({ 'user': usr, 'userid': id });
    let contentRequest = https.get({ url: "<https://website_stored_in_file_cabinet_1.html>", headers: headerObj });
    context.response.write(contentRequest.body);
  }

  function postFunction(context) {
    let params = context.request.parameters;

/* creating record from param values */

    let newRecID = newRec.save();
    let newRecURL = url.resolveRecord({ isEditMode: false, recordId: newRecID, recordType: "customrecord_idaud" });

    let _fname = "name";
    let _id = 77;

    let headOb = ({ 'fname': _fname, 'uid': _id });
    let conReq = https.get({ url: "<https://website_stored_in_file_cabinet_2.html>", headers: headOb });

    context.response.write(conReq.body);
  }

  function onRequestFxn(context) {
    if (context.request.method === "GET") {
      getFunction(context)
    }
    else {
      postFunction(context)
    }

  }
  return {
    onRequest: onRequestFxn
  };
});
b
the file cabinet is meant to be used in a browser
which uses gets
quit abusing the file cabinet
u
while i do not understand the seemingly-hostile choice of words, I'd still like to know if you can propose a solution to the problem I have. i just wish to send a value over to an html I'm hosting through netsuite's file cabinet. since you posit that this is "abusive", could you point me in a better direction?