updating Create HR Case UI action in interaction record
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-29-2024 01:07 AM
Hi Everyone,
There's a "Create HR Case" ui action on interaction record, which has a Workspace client script:
As far as i've looked into it 'g_aw.openRecord' is used to open an existing record, then how is this button creating a new record?
Further my requirement is that when a new record is created i wish to set few field values to it example, HR service, Source, assigned to etc. how do i implement this or update the UI action ?
Can someone please help me with this?
Thanks,
Kartikey
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-29-2024 01:24 AM
Hi @kartikey
Here's an updated version of the onClick
function that sets the hr_service
, source
, and assigned_to
fields:
function onClick() {
var USER = g_form.getValue('opened_for');
var NEW_RECORD = '-1';
var TABLE_HR_CASE = 'sn_hr_core_case';
var PARENT_TABLE = g_form.getTableName();
var PARENT_SYS_ID = g_form.getUniqueValue();
var parameters = {
hr_service: 'Your HR Service Value', // replace with the desired value
source: 'Your Source Value', // replace with the desired value
assigned_to: 'Your Assigned To Value' // replace with the desired value
};
g_aw.openRecord(TABLE_HR_CASE, NEW_RECORD, {
userId: USER,
subjectPersonIdOnCase: USER,
parentTable: PARENT_TABLE,
parentSysId: PARENT_SYS_ID,
parameters: parameters
});
}
If you found my response helpful, I would greatly appreciate it if you could mark it as "Accepted Solution" and "Helpful."
Your support not only benefits the community but also encourages me to continue assisting. Thank you so much!
Thanks and Regards
Ravi Gaurav | ServiceNow MVP 2025,2024 | ServiceNow Practice Lead | Solution Architect
CGI
M.Tech in Data Science & AI
YouTube: https://www.youtube.com/@learnservicenowwithravi
LinkedIn: https://www.linkedin.com/in/ravi-gaurav-a67542aa/
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-29-2024 01:50 AM
If I click on the Create HR case UIaction/button it's redirecting to the case creation page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-29-2024 01:52 AM
share your Script
If you found my response helpful, I would greatly appreciate it if you could mark it as "Accepted Solution" and "Helpful."
Your support not only benefits the community but also encourages me to continue assisting. Thank you so much!
Thanks and Regards
Ravi Gaurav | ServiceNow MVP 2025,2024 | ServiceNow Practice Lead | Solution Architect
CGI
M.Tech in Data Science & AI
YouTube: https://www.youtube.com/@learnservicenowwithravi
LinkedIn: https://www.linkedin.com/in/ravi-gaurav-a67542aa/
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-29-2024 01:55 AM
No I mean, it's redirecting me to the case creation page, and if i create an HR case from here then its not setting the values we provided.