Field subcategory field depending on multiple categories field sys_choice
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-13-2024 12:53 AM
Hello,
I have an issue, I try to create my script include function to set the subcategory results depending on category value.
I created a simple script include with all the conditions filter from the sys_choice, in the reference qual i put this -> javascript: new EDFcatalogUtils().getSubcategory(current.variables.v_category);
Thanks for your help
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-13-2024 06:44 AM
Hi @Jeff W NZAO B
Could you please provide more information on this requirement. Is there service portal form? Why you wrote script include when you have option to use dependency field ref this.
Please provide snapshot of script include
Please Mark ✅ Correct & 👍 Helpful, if applicable.
Regards,
Akshay
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-14-2024 01:28 AM
I'm creating the function in a script include, to filter my subcatery list by adding the query filter on incident table, so at the end i want on my portal form the subcategory field filtered on incident values only
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-14-2024 01:34 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-14-2024 02:43 AM
I created my script include where i put my function for the subcategory, and i added the function name in the reference qual of my varaible fiedl from the portal form.
The subject is portal form
maFunction: function(subcategory){
//Filter the subcategory to with the category
var gr = new GlideRecord('sys_choice');
var subcategories = [];
gs.info("Subcategory et subcategories" + ' '+ subcategories + ' '+ subcategory);
gr.addEncodedQuery('element=subcategory^name=incident^language=fr^inactive=false' + subcategory);
gr.query();
while (gr.next()) {
subcategories.push(gr.subcategories.toString());
}