Scenario:
2 lookups Country and City
When the user selects UK from first lookup then second lookup lists cities belongs to UK( based on lookup filtering feature)
Now the user would like to update Country to Denmark. so when the user selects country as Denmark then the city lookup should be cleared. And then the user gets a chance to choose cities belongs to Denmark.
This could be achieved by simple javascript by passing an attribute.
Code Snippet:
function SetLookupNull(lookupAttribute)
{var lookupObject = Xrm.Page.getAttribute(lookupAttribute);
if (lookupObject != null)
{
Xrm.Page.getAttribute(lookupAttribute).setValue(
null);
}
}
The function call is on the onchange event of first lookup
Please note that we need to pass the attribute name of the lookup which should be cleared.
The key advantage of the above function is reusability. You could clear any lookup value as per the need by supplying the attribute name as shown.

