Get domain template only if it's needed

Change-Id: I890eca3cd2283557658e6fe0f1830548339faadf
Merge "Get domain template only if it's needed"