我有多个位置,有多个问题可以解决。根据位置和问题,票证将被路由到特定的技术人员。我不确定如何向多个技术人员查询或过滤多个位置、多个问题。例如:位置1,计算机问题,发送给计算机技术人员。位置1,布线问题,已发送给布线技术部。
发布于 2018-08-05 02:16:12
这是你从这个解决方案(GIF)中得到的: Assign Issues to Techs
首先,您需要设置与您的模型的关系,以便您可以通过过滤器进行查询,并根据技术类型和位置将问题“分配”给Techs。您的模型关系将如下所示:
One Issue to One Location
多个将发布到一个技术
然后创建问题,并将位置和技术与Forms小部件相关联。如果要根据条件自动将问题分配给技术人员,则必须用另一个函数替换表单按钮上的默认"Create New Item“onClick函数。您可以更改与客户端脚本或服务器脚本的关联。请参阅文档here。尝试我创建的这个客户端脚本:
function createAssignIssuePublic(){
// Datasources declaration
var issuesDatasource = app.datasources.Issues;
var locationDatasource = app.datasources.Locations;
// Creates an Issue item(record) and after it's finished a Tech is associated to it.
// Notice the callback function.
issuesDatasource.createItem(function(record){
var techsDatasource = app.datasources.Techs;
// Create a query.
var techsQuery = techsDatasource.query;
var issue = issuesDatasource.item;
var location = issue.Location.Name;
// Setting the conditionals to assign Tech per issue and location
if (issue.Type == "Computer issue"){
// Query by filter (name equals)
techsQuery.filters.Name._equals = "Computer Tech";
// Reloads Tech datasource per previous query filter.
// Once loaded, it relates the tech item to the issue item/record.
techsDatasource.load(function(){
var relatedTech = techsDatasource.item;
// Changes the Associated Tech
record.Tech = relatedTech;
});
}
// If issue is "Wiring issue" but NOT in a "Critical Location"
else if (issue.Type == "Wiring issue" && location !== "Critical Location"){
techsQuery.filters.Name._equals = "Wiring Tech";
techsDatasource.load(function(){
var relatedTech = techsDatasource.item;
record.Tech = relatedTech;
});
}
// If issue is "Wiring issue" but IN in a "Critical Location"
else if (issue.Type == "Wiring issue" && location == "Critical Location"){
techsQuery.filters.Name._equals = "Tech Lead";
techsDatasource.load(function(){
var relatedTech = techsDatasource.item;
record.Tech = relatedTech;
});
}
else{} });}最后一个按所选技术显示问题的表的原因是,Dropdown小部件的值为@datasources.Issues.query.filters.Tech._equals,并且它会重新加载问题数据源onValueChange。
https://stackoverflow.com/questions/51655129
复制相似问题