Added logic to dynamically creating the field map

Added logic to dynamically creating the field map