Hi, to run https.request (request a netsuite url) ...
# suitescript
x
Hi, to run https.request (request a netsuite url) in a netsuite server side script, how to set up the authorization header? Which authorization method is recommanded?
b
you dont usually get too many choices about authorization
the server you are sending requests to chooses acceptable authorization methods
x
Yes. That is Netsuite which i am sending request to. 😀
b
then why are you trying to use https.request?
x
to create otherrelationship in a user event script.
b
that sounds like you are trying to get the script to pretend to be a user to login to netsuite to get the jsessionid cookie
more normal methods are to use a task.EntityDeduplicationTask to merge two similar entities
or to use record.transform, which is only likely to work on newly created entities
if you only need to support the ui, then you can redirect to the url that creates the relationship
n
@battk I believe @Xiaolei Hu is trying to create a related record - vendor, customer, contact. @Xiaolei Hu I assume you are following a SuiteAnswer, because that's where NetSuite has suggested this solution but it doesn't work anymore ever since they have disabled the username/password authorization. And it is not supported by TBA last time I checked - NS Support told me this. May be that has changed.
b
my guess is this article, which stopped working when nlauth was retired
all 3 of my suggestions are capable of creating other relationships, though the record.transform one is not very reliable
x
Thanks for all the answers! First of all, i want to do it in script, instead of UI. And i want to do it in Server side script, not in Client script (client script can skipp the autorization.) This is the suite anwser i found. https://netsuite.custhelp.com/app/answers/detail/a_id/90550/kw/create%20partner%20other%20relationship NLAuth no longer works, so has to use other authorization header as i undersstand.
Then it does not work to do a https.request in netsuite server side to create a related vendor, customer? @NickSuite Is it possible to use Oauth2.0?
n
It was not possible last time I tried it... and it was like an year ago.
x
Thanks for your time. 😀
n
Try the suggestions of @battk
x
The question is how to replace NLAuth with new authorization
b
my suggestions are how to create other relationships via methods that dont require authorization
x
task.EntityDeduplicationTask i have not used before. Seems this is used to handle duplicates, instead of creating otherrelationships.
b
you can merge 2 different entity types, which will be represented as an other relationship on the combined record
x
Would test on this. Thanks!