Copy the Company from a problem record into a problem task related to it
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-25-2023 11:30 PM - edited ‎01-26-2023 12:09 AM
I have a related list table (problem_task) related to the problem table, which allows me to create new problem tasks related to a problem record.
Looking for a quick way to copy the company from the problem into the newly created problem tasks. (as I want this to happen when I use the NEW button in the related list). I tried of
Display business rule:
Table: Problem task
Insert: true
Update: false
Advanced: false
Condition: Blank
Script:
g_scratchpad.ci_id = current.problem.company;
g_scratchpad.ci_display = current.problem.company.getDisplayValue();
Client script:
Table: problem task
Type: onLoad
Script:
function onLoad() {
g_form.setValue('company', g_scratchpad.ci_id, g_scratchpad.ci_display);
}
Value getting updated in form, but showing empty in list view ?
Any quick tips on that?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-26-2023 12:04 AM
Hi @Chandu14
As per you onLoad client script you are setting value for 'cmdb_ci' instead of 'company' field. Try to change that and see what will be the results.
Please Mark My Response as Correct/Helpful based on Impact
Regards,
Gunjan Kiratkar
2X ServiceNow MVP
Community Rising Star 2022
Youtube : ServiceNow Guy
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-26-2023 12:18 AM
Even after updating with company, its not working, and one more observation is like, for admin users its showing value in list view, and for non admin users its showing as empty ,,,
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-26-2023 12:06 AM
When you click the new button it creates a blank form with a few pre-populated fields, these haven't been submitted to the server yet so the display business rule won't return a value. You should be able to use GlideAjax in your onLoad client script to get the value of the company field of the parent problem and populate it on your problem_task
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-26-2023 12:20 AM
the problem record is already existed right, so that company value will be in database, but the issue is its not visible in list view, in XML view also I can't see value