- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-11-2017 05:24 AM
Hi All,
I have a record producer that will be used on our Service Portal.
This has the variable u_brands (Are any of your brands affected?). I need the answer from this to filter the choices available in the u_envi variable (Which environment is affected, if known?).
u_brands is a reference of the core_company table and u_envi is a lookup select box of the cmdb_ci_environment table.
I've tried to create a script includes to use in the reference qualifier of the u_envi variable, however it is just showing every environment rather than filtering on the answer from u_brands.
As can see from the screenshots I am only expecting to see the 1Answer Network Live (Classic) environment with the brand boxeo selected.
Any help is greatly appreciated.
Reference qual:
javascript: new company_user().getEnv(current.variables.u_brands);
Script includes:
getEnv : function(u_brands){
var brand = u_brands;
var env = newGlideRecord('cmdb_ci_environment');
env.addQuery('company', brand);
env.query();
while(env.next()){
sysid.push(env.name.toString());
}
return 'sys_idIN'+sysid.join(',');
},
type: 'company_user'
});
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-11-2017 07:36 AM
So you have only 2 records, You need to check the System Logs -> All module to view the log. Please try this out once
getEnv : function(u_brands){
var sysid = '';
var brand = u_brands;
if(brand == ''){
return 'sys_idIN';
}else{
var env = new GlideRecord('cmdb_ci_environment');
env.addQuery('company', brand);
env.query();
while(env.next()){
sysid += "," + env.sys_id;
}
return 'sys_idIN'+sysid.substring(1);
}
},
type: 'company_user'
});
Thank You
Please Hit Like, Helpful or Correct depending on the impact of response
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-11-2017 08:07 AM
Hi Alikutty,
That seems to have worked great.
Thanks for all your help!!
I do have another question that is sort of related. Since I have changed the u_envi field to a reference field instead of a lookup select box, Once I select an answer in the u_envi field it is moving some of the fields on the record producer, have you any idea what would cause this?
Before Answer:
Once Answer is selected:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-11-2017 08:10 AM
Just to add to the above, If I click the 'Try It' button on the record producer this does not happen, it only happens when I am using the record producer when on the portal.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-11-2017 08:16 AM
Do you have any UI policies or client script to hide fields that are near the environment variables (The image is not very clear though)? Setting up things in portal is sometimes a mess. If there are no hide scripts, then try changing its position to see if it works.
Also can you please mark my response as correct answer, and whichever was helpful to you.
Thank You
Please Hit Like, Helpful or Correct depending on the impact of response