Two lookups to the same entity pre-filled in creation mode

303 Views Asked by At

I have a customised Entity X and I have two lookups to account, and when I want to create a record of entity X from account, I find myself with a form with the two lookups of account prefiled by the name of the account I started from. I need to make one of those two lookups not pre-filled by the name of the main account in creation mode, is it possible to do this? Thanks in advance,

2

There are 2 best solutions below

0
On

Clear the field in the form's onload event, like this:

if (Xrm.Page.ui.getFormType() === 1) {
   Xrm.Page.getAttribute("new_myaccountid").setValue(null);
}
1
On

Go to Relationships for your entity and find the Relationship for the Lookup that you want left blank. Open it and go to Mappings and remove the mapping to the parent account.

Mappings define which fields get mapped from the parent to the child when creating a child from the parent.