我正在使用suitescript 2.0,我需要知道是否有办法在运行时获取suitelet的url?
对于外部网址,您可以执行以下操作:
require(['N/runtime', 'N/url'], function(runtime, url){
var cs = runtime.getCurrentScript();
var scriptURL = url.resolveScript({
scriptId: cs.id,
deploymentId: cs.deploymentId,
returnExternalURL: true
});
如果您获得内部URL,则可能还必须将host和scheme添加到返回的根相对值。在2017.1版本中,url将有一个url.resolveDomain方法,可以让您查找主机。
function onRequest(context) {
log.debug({
title: 'context',
details: context.request.method
});
if (context.request.method === 'GET') {
fil = context.request.parameters.employee
log.debug({
title: 'url',
details: fil
});
}
这样做..........如果您希望在脚本运行或被调用时获取脚本的参数。