anyone know if there’s a way to get the ‘publishab...
# suitescript
m
anyone know if there’s a way to get the ‘publishable form url’ for an online form on a custom record programmatically? i have some automations that utilize them, but they’re hard coded in scripts. this means that after a sandbox refresh, the customizations in SB point to prod and that’s, well, bad. 😄
j
Copy code
var environment = usercontext.getEnvironment();
    if (environment == 'SANDBOX') {
        var Path = '<https://12345-sb1.app.sandbox.netsuite.com>';

    }
    if (environment == 'PRODUCTION') {
        var Path = ''<https://12345.app.netsuite.com>';

    }
how I normally handle such things... not pretty but works
m
sure, i did something similar for now, but we have multiple sandbox and dev accounts so the list of choices just keeps getting longer 😄 Thanks for the example though!
w
Have you looked at N/url ?
m
yeah, N/url doesn’t have any references for external forms. the url format for external forms is entirely unique (compared to even the external urls for suitelets etc)
w
Not even url.HostType.FORM? (TBH I've never used external forms, just external suitelets)
FWIW I had a similar problem yesterday with external files, it turned out that even though the domain that N/url gave didn't match the one listed as the external URL in the UI they both worked, apparently NS is migrating URL formats so it's a bit inconsistent at the moment.
m
you can get a domain relsolved there, and while it doesn’t ‘match’ it works. the formui, and the
h
parameter aren’t available/discoverable that i can see.
Copy code
url.resolveDomain({hostType: url.HostType.FORM, accountId: "xxxxxx-sbx"})
"<http://forms.na0.netsuite.com|forms.na0.netsuite.com>"