Anyone know how to create an otherrelationship lin...
# suitescript
b
Anyone know how to create an otherrelationship link from a server script? Or do a get operation on a https://accountid.app.netsuite.com/app/common/entity/company.nl url? NetSuite's SuiteAnswer solution for other relationship creation (https://netsuite.custhelp.com/app/answers/detail/a_id/90550/kw/otherrelationship) is to generate a URL and call it from a Suitelet; it is super ugly, but with nothing better I gave it a shot. I can generate the URL and call it from the UI (I'm sure a client script would work similarly) but every time I call it from a user event script I get the NetSuite login page back. I've tried it from Postman using Oauth 1.0, from a user event using Oauth 1.0, and from a user event using NLAuth user+ password (only tried because NetSuite's solution documented it). The URL that works from the UI is: https://accountId.app.netsuite.com/app/common/entity/company.nl?e=T&fromtype=custJob&target=s_relation:otherrelationships&id=888&totype=vendor
that suiteanswer article is actually one that documents one of the more interesting uses of the NLAuth authorization
although im guessing that the NLAuth header no longer works
b
Thanks @battk yeah, I think NLAuth worked at one point but now that they've improved security it doesn't work so seems like there's no way to call the UI from a serverscript (because why would you do that). I heard from a friend of a colleague that they spent two weeks trying to get the url to work from a server script, but couldn't so just did a client script in the end to process 100 at a time. The DeDupe task in that article looks promising, I'm going to give that a shot and see how it goes
b
server side scripts dont have the cookie required to access internal urls
👍 1
a user event script triggered via the ui has a chance at getting the cookie to use, though thats pretty desperate
b
yeah, that makes sense, thanks. I talked with the person requesting it and it's just for an initial data load so I'm just going to do a client script
I briefly looked at the dedupe task solution but it wasn't working, and I don't think it's important enough to troubleshoot that but will look into it again if it becomes a more common use case
Thanks again for the assistance!