
I have a parent (Master Project) record with a subgird to show associated project records. When I click add new project, the lookup field on the project field gets automatically filled in (which is a 1:N relationship), so it is working correctly, however, now the need is to have that lookup field to be null only upon creation of record, so that the users can select a different value. As there is already another field capturing the parent record name. So if it is an existing record and something changes, no need to run the script to null the field.
How can I do this? I am guessing only with a script?
Hi USA80,
The lookup field gets automatically filled when you click new in the sub-grid, which is by-design.
In my example, optionset entity(Parent) and Custom(Child) have 1:N relationship, when I click new button of sub-grid view from optionset entity, optionset lookup field in custom form can be filled automatically.
You can go settings > Customizations > Customize the system > Entities > Custom(Child entity) >N:1 relationships to find relationship between Custom an optionset entity.
Navigate to ;'Mapping' tab, you can find the optionset field mapping, which is the reason for filling lookup field automatically.
Now you can using business rules to clear lookup field when load page, which is one no-code way.
Go settings > Customizations > Customize the system > Entities > Custom(Child entity) >Business rules.
Test result:
Regards,
Leah Ju
Please mark as verified if the answer is helpful. Welcome to join hot discussions in Dynamics 365 Forums.