3

I am looking for a way to mark data as exported in some way.

The scenario is that we are receiving and capturing data for enquirers (people making enquiries) on behalf of a third party.

The 3rd party doesn't have access to the system (and are not allowed to be given log in - apparently this is a 'politics' reason) however need to be given an extract of all the people who have made contact in the last 24 hours.

Ideally I would like to pull a report (automatically generate a CSV file perhaps) but mark the data in some way with an exported flag or date so we can show it has been exported.

Any suggestion as to how I could do this?

(Open to other suggestions such as an export that sets an activity as completed or something too, or something that can be developed by the API)

  • 1
    if you are pulling a report then better to use date range - which will give you only for the selected date. so you can run everyday – Ramesh - ARTECH Consultancy Jan 8 '19 at 13:08
3

This Log Export extension "logs to a files within the ConfigandLog directory whenever an export happens, who performed it what columns involved and the relevant entity IDs"

There is a blog about it here

| improve this answer | |
  • I read the question as asking a different question - they want to be able to locate a subset of stuff added/edited in civicrm in the last 24 hours. That extension seems to serve a different purpose? – Demerit Jan 17 '19 at 19:54
  • Oh I see. You could use it as a way of making "24 hours" more exact, so that you're searching for changes since the last export. – Demerit Jan 17 '19 at 20:06
  • i agree it is a bit of a tangential answer but had just come across the link again and remembered a couple of Q+A on here that it might be helpful to - even if only for others reading the Q rather than the original poster. – petednz - fuzion Jan 18 '19 at 23:30
2

How are you recording the enquiry? As an activity? If so, you could add a custom field "exported" (Yes/No field, default No), then search for exported=no, export, and update exported=yes.

There are various problem scenarios you might want to think about: eg if an export is lost after you generate it (eg email bounces), do you need to be able to reproduce an export? How important is it to make sure you export every enquiry once, and once only? If you need a robust process you could take a look at how Accounting Batches manages exports of contributions.

| improve this answer | |
  • Danger Will Robinson! Custom fields should be avoided at all costs for a myriad of reasons, not the least of which are: ***The field names will be different depending on the region you add them to --already_exported will be saved as already_exported_587 (or similar) and the number will change in each environment. Dev might be 587, but production will be 621 etc. If you end up writing code against this field, you'll be in random-field-name-hell. >shudder< ***No guarantee that custom fields will work the same way in CiviCRM 6 Never use custom fields if you have other options. – Neil Davis Jan 28 at 15:14
  • @NeilDavis Custom fields are fully supported and an integral part of CiviCRM and you'll find them on any significant implementation. There are some challenges programming with them and plenty of scope for writing poor code but you might want to ask some questions around good practice for coding with custom fields if you can't find what you need in the documentation. – Aidan Jan 29 at 16:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.