https://netsuiteprofessionals.com logo
#suitescript
Title
# suitescript
x

Xiaolei Hu

03/24/2022, 8:08 AM
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

battk

03/24/2022, 8:12 AM
you dont usually get too many choices about authorization
the server you are sending requests to chooses acceptable authorization methods
x

Xiaolei Hu

03/24/2022, 8:14 AM
Yes. That is Netsuite which i am sending request to. 😀
b

battk

03/24/2022, 8:14 AM
then why are you trying to use https.request?
x

Xiaolei Hu

03/24/2022, 8:15 AM
to create otherrelationship in a user event script.
b

battk

03/24/2022, 8:17 AM
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

NickSuite

03/24/2022, 8:32 AM
@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

battk

03/24/2022, 8:33 AM
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

Xiaolei Hu

03/24/2022, 8:35 AM
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

NickSuite

03/24/2022, 8:40 AM
It was not possible last time I tried it... and it was like an year ago.
x

Xiaolei Hu

03/24/2022, 8:44 AM
Thanks for your time. 😀
n

NickSuite

03/24/2022, 9:07 AM
Try the suggestions of @battk
x

Xiaolei Hu

03/24/2022, 9:10 AM
The question is how to replace NLAuth with new authorization
b

battk

03/24/2022, 9:25 AM
my suggestions are how to create other relationships via methods that dont require authorization
x

Xiaolei Hu

03/24/2022, 9:28 AM
task.EntityDeduplicationTask i have not used before. Seems this is used to handle duplicates, instead of creating otherrelationships.
b

battk

03/24/2022, 9:29 AM
you can merge 2 different entity types, which will be represented as an other relationship on the combined record
x

Xiaolei Hu

03/24/2022, 9:30 AM
Would test on this. Thanks!
2 Views