Steps to Default a Sales Order Attribute when there is no Defaulting rule for that Attribute

Generally to default a Sales Order Attribute programmatically, we need to set the attribute value in its global record, ont_header_def_hdlr.g_record. for Sales Order Header and ont_line_def_hdlr.g_record. for Sales Order Line. But this process only works for the attributes which has defaulting rules, Here in this article I will show a way to set the value for the attributes which doesn’t have defaulting rules.

Lets take an example of defaulting ATTRIBUTE1 field of sales order header for which we dont have a defaulting rule. To set ATTRIBUTE1 we need to consider another attribute which has a defaulting rule associate it as a DUMMY defaulting rule. In this example lets consider ‘Shipping Method’ as dummy defaulting rule. For ‘Shipping Method’ select a defaulting source as ‘PL/SQL API’ and call a package with below logic.

The below logic is just to use ‘Shipping Method’ as dummy defaulting rule and set the value for attribute1 by setting it to ont_header_def_hdlr.g_record.attribute1 and return ‘Shipping Method’ value to ‘Shipping Method’ defaulting itself.