我克隆了OOTB widget-form,命名为widget-form-md,并为hideRelatedLists创建了一个额外的选项模式:
我有一个单独的小部件,它嵌入我克隆的widget-form-md,希望通过Material Design模式显示它。我的模态的客户端脚本如下所示:
function x ($scope, $location, spUtil, amb, $mdDialog, $http, $window, $rootScope, $timeout){
var c = this;
c.newRequest = function() {
$mdDialog.show({
contentElement: '#hr_request',
parent: angular.element(document.body),
clickOutsideToClose:true
});
spUtil.get("widget-form-md", {
request_name: 'hr_request',
view: 'hr_request',
table: 'x_dnf_federal_hr_e_federal_hr_cases'
}).then(function(response) {
c.hr_request = response;
});
};
}
将选项模式传递到spUtil的正确语法是什么?我试过了
spUtil.get("widget-form-md", {
request_name: 'hr_request',
hideRelatedLists: true
view: 'hr_request',
table: 'x_dnf_federal_hr_e_federal_hr_cases'
})
和
spUtil.get("widget-form-md", {
request_name: 'hr_request',
options: {hideRelatedLists:true},
view: 'hr_request',
table: 'x_dnf_federal_hr_e_federal_hr_cases'
})
他们都没有工作,我似乎无法找到有关如何做到这一点的任何文件。有什么建议?谢谢!
第一:选项模式用于通过表格配置小部件:https://dxsherpa.com/blogs/widget-options-schema-in-service-portal/
缺少参数的解决方案,在被调用的小部件的选项中没有显示在这里:https://community.servicenow.com/community?id=community_question&sys_id=ea83c365dbd8dbc01dcaf3231f9619d2
使用spUtil(client)调用窗口小部件时,使用“input”访问传递的参数。
使用$ sp(server)调用窗口小部件时,使用“options”访问传递的参数
由于使用spUtil调用窗口小部件,因此我们在输入对象中的服务器上有数据。因此在被调用小部件的服务器中:
data.requestName = input.request_name;
data.hideRelatedLists = input.hideRelatedLists;
// or the short version, if widget also gets parameters from URL and options:
data.requestName = $sp.getParameter('requestName ') || options.requestName || input.requestName;
遗憾的是,这在官方文档中没有描述:https://developer.servicenow.com/app.do#!/api_doc?v=london&id=spUtilAPI