Setting a Default Value of a Child record's field based on the value of a field in a Parent record

Less than one minute read time.
For example, you may have a requirement to set the initial default value of a Quotation description to be the same as the Opportunity description.

This can be done using an onCreate script.

In this example we would need to add the code into the quot_description field in the screen QuoteSummary.

if (eWare.GetContextInfo("opportunity","oppo_opportunityid"))
{
DefaultValue = eWare.GetContextInfo("opportunity","oppo_description");
}

The code checks to see if the Quotation is being created whilst in the context of an Opportunity. If it is being created in context of an opportunity then the code sets the initial value of the field to be the same as the parental oppo_description field.

The DefaultValue property can only be set normally when the record is first created. The exception is when it is used on fields that are referenced within a workflow rule action of type "Set Column Value".