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 01:17 AM
You're trying to populate the company field on the problem task when you create a new one right? When you click new it creates a new problem_task form and pre-populates the parent field with the problem. This data only exists in the client, it hasn't been submitted to the server yet. our display business rule runs when a user requests an existing record from the server so it won't return a value for your new form as it's not fetching data from the server.
There are plenty of guides on how to use GlideAjax if you're not sure, happy to give assistance if you get stuck as well.
Another option might be to set the default value of the company field to 'javascript: current.parent.company' but i've not tested that so i can't confirm if it'll work.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-26-2023 08:37 AM
You can use a very simple before insert business rule on the problem_task table. With not conditions.
Then on the when on the actions tab set the following.