- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-16-2020 09:10 AM
We have a requirement as part of Separation process to collect input from an HR as to whether the subject person on the HR case should be rehired or not. There is a rehire flag on HR profile. The HR do not have access to the backend they only login to the portal.
I tried using employee form but this form should uniquely map to a record, i cannot map the response from HR to the profile of subject person's HR profile.
Is there a way to get response from HR from the portal and update the "Rehire" flag on the HR profile of subject person on the HR case?
Best
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-03-2020 09:28 AM
It might be a timing issue. Can you try set the business rule to Async? Or order to 1001?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-26-2020 01:43 AM
Hi Rajeeshraj,
You can add mapping:
Add Mappings field appears on the employee form.
In the mapping record you can map a question to a field in a table you want. The answer will then be used to set the value of the field.
For example, you can map a question for the user's manager to the corresponding field on the User [sys_user] table. When the user views the employee form in an HR task, they will see their manager's name filled in for that field. Because it is marked as read-only, the user will be able to read but not update that field.
Please refer to https://docs.servicenow.com/bundle/orlando-hr-service-delivery/page/product/human-resources/task/con... for more information
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-29-2020 05:27 AM
Thanks for the reply, but I don't think using employee form i can get a response from an HR manager and update a field on the HR profile of another user because employee form should uniquely map to a record, i cannot map the response from HR manager to the profile of subject person's HR profile.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-29-2020 02:38 PM
Hi,
Can you create an After business rule on the HR Task? When the manager submitted the input the HR Task moves to Closed complete so that can be the trigger.
The script would look something like this:
//variable(s) that you want to set on the HR Profile
var rehire;
//Get Employee input results
var grSurveyResults = new GlideRecord('asmt_metric_result');
grSurveyResults.addQuery('instance.sys_id', current.survey_instance);
grSurveyResults.query();
gs.info("count " + grSurveyResults.getRowCount());
while (grSurveyResults.next()) {
//You can check the question asked with grSurveyResults.metric.question. Replace "Should this person be rehired?" with your question. Or use Metric sys_id
if (grSurveyResults.metric.question == "Should this person be rehired?") {
//If answer to the question is Yes
if (grSurveyResults.string_value == "Yes") {
rehire = true;
}
//Else check if it is no.
else if (grSurveyResults.string_value == "No") {
rehire = false;
}
}
}
//Only if we have a value for rehire we get the profile and update
if (rehire) {
//get HR Profile and update
var grHrProfile = new GlideRecord('sn_hr_core_profile');
if (grHrProfile.get('user', current.parent.subject_person + '')) {
grHrProfile. <rehire boolean field> = rehire;//replace <rehire boolean field> with your custom field
grHrProfile.update();
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-02-2020 11:46 AM
Hi
I see you marked my response as helpful. If it solved your issue, can you please mark as Correct answer?
Kind regards,
Willem