Add the missing entity keys and only add entity keys if the associated fields exist

Related to #3517130

Merge request reports

Loading