Help scripting Client Script

ssellmeyer
Tera Guru

In Order Management: 

How can I script a query in an 'onChange' Client Script on the 'Product Order' table to retrieve all the associated 'Order Line Items'?

 

Order Line Item table: sn_ind_tmt_orm_order_line_item

Product Order table: sn_ind_tmt_orm_product_order 

 

Matching field is the 'Order' field on the 'Product Order' table: order_line_item.order

Matching field is the 'Order' field on the 'Order Line Item'table: order

See attached.

 

I need to the onChange Client Script query to return the associated Order Line Items.

 

This is what I have that it is not working:

function onChange(control, oldValue, newValue, isLoading, isTemplate) {
    if (isLoading || newValue === '') {
        return;
    }
var orderLineItem = g_form.getTableName();

// Get the reference field to the parent table
var parentField = 'order_line_item.order';  

// Get the parent record
var parentSysId = g_form.getValue(parentField);

if (parentSysId) {
// Query the parent table
var parentTable = g_form.getValue(parentField.sn_ind_tmt_orm_order_line_item);
 
if (g_form.getValue.parentSysId) {
// Access parent table field
var parentValue = g_form.getValue('order');

 

 

Greatly appreciate help!!!

Thank you

1 REPLY 1

ssellmeyer
Tera Guru

This is what I have that is not working:

 

function onChange(control, oldValue, newValue, isLoading, isTemplate) {
    if (isLoading || newValue === '') {
        return;
    }

var orderLineItem = g_form.getTableName();

// Get the reference field to the parent table
var parentField = 'order_line_item.order';  

// Get the parent record
var parentSysId = g_form.getValue(parentField);

if (parentSysId) {
// Query the parent table
var parentTable = g_form.getValue(parentField.sn_ind_tmt_orm_order_line_item);
 
if (g_form.getValue.parentSysId) {
 
// Access parent table field
var parentValue = g_form.getValue('order');
 
Can someone please help?
Thank you