简体   繁体   English

Netsuite:如何在SuiteScript中获取DataCenter

[英]Netsuite: How to getDataCenter in SuiteScript

I wish to know how to get dynamic data center url. 我想知道如何获取动态数据中心网址。 I have checked in nets and knew that getdatacenterurl only applicable for REST while I wish to do the same in Suitescript. 我已经检查了网络,并知道getdatacenterurl仅适用于REST,而我希望在Suitescript中也是如此。

The reason for this is because currently I am hardcoded the data center in URL and this will not work if the customer change their data center in future. 这样做的原因是因为当前我已使用URL对数据中心进行了硬编码,并且如果客户将来更改其数据中心,则将无法正常工作。

I know nlapiResolveURL only help to generate the later part of URL and we still need to define the base domain at the first place. 我知道nlapiResolveURL仅有助于生成URL的后半部分,我们仍然需要首先定义基本域。

Any helps? 有帮助吗?

A little hackish but you could use nlapiResolveURL to ask for the external URL of a Suitelet and then replace forms with system and then slice the first part before app. 有点骇人听闻,但您可以使用nlapiResolveURL询问Suitelet的外部URL,然后用system替换表单,然后在应用程序之前将第一部分切成薄片。 Something like this: 像这样:

var externalURL = nlapiResolveURL('SUITELET', 'customscript_xxxx', 'customdeploy_xxxx', true);
externalURL = externalURL.replace('forms', 'system');
var dataCenter = externalURL.slice(0, externalURL.search('app'));

Note: The suitelet doesn't need to be public, you can use an internal one and it should still return the first part of the url. 注意:套件不必是公共的,您可以使用内部套件,它仍应返回url的第一部分。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM