
- Post History
- Subscribe to RSS Feed
- Mark as New
- Mark as Read
- Bookmark
- Subscribe
- Printer Friendly Page
- Report Inappropriate Content
on 07-07-2021 05:39 AM
It's quite easy that the number of HR Services published to a Portal grows over time and leaving maybe not the best employee experience to navigate through.
The General Inquiry is good, but it also demands a first line to act as dispatcher. Could we create a General Inquiry but map it to correct service from the beginning and also drive assignments then we could also remove the dispatcher role and saving some time. Below is an attempt to create one "Generic" record producer for questions.
So the first step would be to create a Record producer.
In the script field of the record producer I added this line to map to correct service on the HR form:
// Route to correct service
current.sys_class_name = producer.hr_service.topic_detail.topic_category.coe;
In this example I have three variables in my Record producer "Ask a Question" and one and two are the interesting ones:
1. Choose a topic - reference field and referenced to Topic category. Here you can of course choose to filter a number of Topic categories that you want to be visible.
2. Choose a service - reference field and referenced to HR Service. Here you would want to display HR Services depending on what Topic category you choose. To do so I created a script include and added it to the reference qualifier:
Script include:
Name: CategoryHelper
API name: sn_hr_core.CategoryHelper
Application: Human Resources: Core
function CategoryHelper()
{
var topic = current.variables.choose_topic;
var topic_array = [];
var getTopic = new GlideRecord('sn_hr_core_service');
getTopic.addQuery('topic_detail.topic_category',topic);
getTopic.addQuery('case_options', '62d0a6e9db8be810366c2b24ca9619f6'); // sys id of Show on portal case option
getTopic.query();
while(getTopic.next())
{
topic_array.push(String(getTopic.sys_id));
}
return 'sys_idIN' + topic_array.toString();
}
This will help to sort the correct HR Service depending on Topic Category. BUT you don't want to display all HR services and that is were line 7 above comes in. I created a Case option "Show on Portal" and added that to the HR Services that I want to be displayed. This will make it easy for the HR Admins to add or remove services they want to be shown under "Ask a Question"
The result would look something like this:
The next step is that I want to add a Helptext for each HR Service. To make it easy and maintainable for HR Admins I wanted to make use of the Description field on the HR Service:
So I created a Catalog client script in my Ask a Question record producer:
Name: Helptext
Applies to: A Catalog item
Type: OnChange
Variable name: choose_service
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
if (!isLoading) {
g_form.hideFieldMsg('description', true);
if (g_form.getValue('choose_service') != '') {
var so = g_form.getReference('choose_service', function(so) { //reference is passed into callback as first arguments
if (so.u_help_text != '') {
g_form.showFieldMsg('choose_service', so.description, 'info');
}
}); // doAlert is our callback function
}
}
}
Then you would get this result:
/Markus
- 1,166 Views