- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-04-2022 03:28 AM
Hi Team,
I have a requirement wherein when we click on New Order task from the related list, it should then fetch some values and copy it to the fields of the order task.
I am writing the below code in OnLoad client sce
wI am writing the below code in screenshot but alert is throwin blank record instead of sys_id
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-04-2022 03:45 AM
I would suggest to use the display business rule to get the parents details and copied to g_scratchpad variables.
for example:
g_scratchpad.parent_number = current.parent.number;
You can use these g_scratchpad variables in client scripts.
g_form.setValue('field name', g_scratchpad.parent_number);
Thanks!
Sagar Pagar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-04-2022 03:45 AM
I would suggest to use the display business rule to get the parents details and copied to g_scratchpad variables.
for example:
g_scratchpad.parent_number = current.parent.number;
You can use these g_scratchpad variables in client scripts.
g_form.setValue('field name', g_scratchpad.parent_number);
Thanks!
Sagar Pagar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-04-2022 05:45 AM
Hi Sagar,
Actually there are other values as well which I need to populate from parent onload of this form.
Can you tell how to achieve that?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-04-2022 05:49 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-04-2022 06:15 AM
Hi Ankur,
You need to create a display business rule on Order Task table. You can refer this script as example.
Condition: current.isNewRecord() && !current.customr_order_line.nil()
var parentDetails = current.customr_order_line.getRefRecord();
if (parentDetails.isValidRecord()) {
current.u_order_line_item = parentDetails.getUniqueValue(); // reference field
current.your_field1 = parentDetails.your_field1;
current.your_field2 = parentDetails.your_field2;
}
Thanks!
Sagar Pagar