title: get a specific property for a domain in Grails
body: <p>i'm making a tables cleaning service that takes the table name and the date field as arguments , here is the service code : </p>
  
  <pre><code>def cleanTables(tableName , dateField) {
      def comparisonDate
      def numOfRecordsDeleted
      use (TimeCategory){
          comparisonDate=new Date() -1.year
          }
      numOfRecordsDeleted=tableName.where { dateField &lt;=comparisonDate }.deleteAll()
      log.info("deleted : " +numOfRecordsDeleted)
  }
  </code></pre>
  
  <p>i'm successfully passing to this service the <code>table name</code> but i can't pass the <code>date field</code> , so how to get a specific property from a domain for example a domain named <code>Payments</code> got a property <code>dateCreated</code> , so i pass to my service <code>Payments</code> and <code>dateCreated</code>.</p>