- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-25-2022 10:29 AM
Hi All,
On the Task form is the Business Service reference field to cmdb_ci_service.
Today, I have an override ref qual on the Business Service Field when the form is the Incident so when you click on the lookup you are returned certain business service. This Ref Qual works:
javascript: "operational_status=1^"+ (current.category.nil() ? 'u_incident_categoryISNOTEMPTY' : 'u_incident_category=' + current.category)
Now I need this Ref Qual to be 'dynamic'.
If the assignment_group is "A" then the Ref Qual should only be where "operational_status=1"
ELSE the Ref Qual should remain
javascript: "operational_status=1^"+ (current.category.nil() ? 'u_incident_categoryISNOTEMPTY' : 'u_incident_category=' + current.category)
There should be enough space in the Ref Qual field to accommodate an IF statement but every attempt I've tried does not work.
I have tried called a script include, but that has not worked either.
Solved! Go to Solution.
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-25-2022 11:40 AM
I took a stab at it real quick. So the ref qual would look something like:
javascript: new TestScriptInclude().businessServiceRefQual(current);
And the script include:
var TestScriptInclude = Class.create();
TestScriptInclude.prototype = {
initialize: function() {
},
businessServiceRefQual: function(incident) {
var query = '';
if(incident.assignment_group == '3647376ddbb58b04f8d57fc88c961975')
query = 'operational_status=1';
else
if(JSUtil.nil(incident.category))
query = 'operational_status=1^u_incident_categoryISNOTEMPTY';
else
query = 'operational_status=1^u_incident_category= ' + incident.category;
return query;
},
type: 'TestScriptInclude'
};
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-25-2022 11:40 AM
I took a stab at it real quick. So the ref qual would look something like:
javascript: new TestScriptInclude().businessServiceRefQual(current);
And the script include:
var TestScriptInclude = Class.create();
TestScriptInclude.prototype = {
initialize: function() {
},
businessServiceRefQual: function(incident) {
var query = '';
if(incident.assignment_group == '3647376ddbb58b04f8d57fc88c961975')
query = 'operational_status=1';
else
if(JSUtil.nil(incident.category))
query = 'operational_status=1^u_incident_categoryISNOTEMPTY';
else
query = 'operational_status=1^u_incident_category= ' + incident.category;
return query;
},
type: 'TestScriptInclude'
};
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-26-2022 05:11 AM
Thanks Ryan.
I spent some more time last night and this morning.
I must have had a space or weird character.
But when I manually re-entered the syntax referring to your script it then worked.
I really appreciate the help.