code: def workflow_script_import(self):
          
          bsc = getToolByName(self, 'bika_setup_catalog')
          client = self.aq_parent
  
          title = _('Submitting Sample Import')
          description = _('Creating and initialising objects')
          bar = ProgressBar(self, self.REQUEST, title, description)
          notify(InitialiseProgressBar(bar))
  
          profiles = [x.getObject() for x in bsc(portal_type='AnalysisProfile')]
  
          gridrows = self.schema['SampleData'].get(self)
          row_cnt = 0
          for therow in gridrows:
              row = deepcopy(therow)
              row_cnt += 1
  
              # Profiles are titles, profile keys, or UIDS: convert them to UIDs.
              newprofiles = []
              for title in row['Profiles']:
                  objects = [x for x in profiles
                             if title in (x.getProfileKey(), x.UID(), x.Title())]
                  for obj in objects:
                      newprofiles.append(obj.UID())
              row['Profiles'] = newprofiles
  
              # Same for analyses
              newanalyses = set(self.get_row_services(row) +
                                self.get_row_profile_services(row))
              # get batch
              batch = self.schema['Batch'].get(self)
              if batch:
                  row['Batch'] = batch.UID()
              # Add AR fields from schema into this row's data
              row['ClientReference'] = self.getClientReference()
              row['ClientOrderNumber'] = self.getClientOrderNumber()
              contact_uid =\
                  self.getContact().UID() if self.getContact() else None
              row['Contact'] = contact_uid
              # Creating analysis request from gathered data
              ar = create_analysisrequest(
                  client,
                  self.REQUEST,
                  row,
                  analyses=list(newanalyses),)
  
              # progress marker update
              progress_index = float(row_cnt) / len(gridrows) * 100
              progress = ProgressState(self.REQUEST, progress_index)
              notify(UpdateProgressEvent(progress))
  
          # document has been written to, and redirect() fails here
          self.REQUEST.response.write(
              '<script>document.location.href="%s"</script>' % (
                  self.absolute_url()))
docs: Create objects from valid ARImport