Has anyone had any experience using a User Event t...
# general
g
Has anyone had any experience using a User Event to get (https GET) a native Netsuite URL? the response I'm getting is the login page, instead of the intended function. When i plug the url directly into the browser, it works normally, presumably because I'm already logged in.
r
Userevent is getting called through ui or server side ?
g
Ui. Executes after submit on transactions.
b
which native url are you trying to get
g
b
g
That does work, for "supported record types" However, I'm wanting to use the Netsuite url as you can use it to attach unsupported transaction types to support cases, and it does not cause any other errors Eg. Credit Memo, Refund, Return Authorisation
b
what did your attempt to use it look like
g
I'm just going to attach this as plain text. It returns a complete HTML page.
b
the attempt at using record.attach
g
Copy code
{
  "type": "error.SuiteScriptError",
  "name": "SSS_INVALID_ATTACH_RECORD_TYPE",
  "message": "Attaching of record type creditmemo to supportcase is not supported.",
  "id": "",
  "stack": [
    "attachRecord(N/recordImpl)",
    "afterSubmit(/SuiteScripts/ACL/User Event/attachSupportCase.js:35)"
  ],
  "cause": {
    "type": "internal error",
    "code": "SSS_INVALID_ATTACH_RECORD_TYPE",
    "details": "Attaching of record type creditmemo to supportcase is not supported.",
    "userEvent": "aftersubmit",
    "stackTrace": [
      "attachRecord(N/recordImpl)",
      "afterSubmit(/SuiteScripts/ACL/User Event/attachSupportCase.js:35)"
    ],
    "notifyOff": false
  },
  "notifyOff": false,
  "userFacing": false
}
b
start on something like a sales order first
what you are trying doesnt even work for the more normal transactions
g
Only when url is inputted directly into browser
b
i dont know what your code looks like, but your error message suggests it wouldnt even work for a sales order
g
Yeh, I don't know how to get Netsuite to recognise the login credentials, and unfortunately I don't have both id's in client
b
work at getting record.attach working for support cases to sales orders
then graduate to support cases to credit memos
your approach so far suggests you never tried getting sales orders or something similar to work
and then dismissed it as an option after failing at credit memos
dismiss it after you get a supported transaction like sales orders working
g
Sales orders work for me using record.attach, but I don't require that. Only required for non-compatible transactions, hence why I am using a direct link.
Just keep getting stuck with how to call that link from a server script.
*url
b
what did your code for record.attach on a sales order look like
g
Copy code
record.attach({
    record: {
        type: record.Type.SALES_ORDER,
        id: newRec.id},
    to: {
        type: record.Type.SUPPORT_CASE,
        id: scId}
});
It returns void, but it works
b
fails for me
g
Interesting I'll see if I get time to play with Client side tomorrow, maybe a JQuery
c
You might be better off just creating a custom field on your case to reference the transaction
w
❤️ 1
👍 2
g
@Watz Appreciate that thanks! For Reference: • It works for Sales Order, but not for Credit Memo. • However, if you specify the type as "transaction" (as a string, rather than the object reference) it will work for other transaction types like Credit Memo.