Hi @EConsulting ,
Apologies for the delayed response, Iāve been on leave.
So as far as I understand it, youāve got a custom object called āVolunteer Hoursā which is associated with the relevant contact. Then youāve got a property on the contact record called āFirst volunteer dateā which you want to copy the āstart dateā to for only the very first āVolunteer Hoursā custom object associated with that contact. Is this correct?
If so, I think this could be achieved very simply by just adding an additional enrolment criteria:
āFirst Volunteer Dateā is not known
This will not solve the issue of backdating data however, it will only work with any future volunteers.
If youāre looking to backdate the data, you could approach it one of two ways:
- Export all of your data, manipulate it manually and import it. Then you could just turn your workflow on and it should all work fine.
- Create a contact-based workflow to handle all backdated data, run it for all relevant contacts and turn it off. Then turn on the workflow you have now with the additional enrolment criteria.
If you go with option 2 there will be some custom code required. Do you have operations hub?
If you do, my recommendation would be to set up a contact-based workflow triggered by contacts with an associated āvolunteer hoursā object.
Then add a custom code workflow step which utilises the āSearchā endpoint for the custom object api (Accounts Dashboard | HubSpot). You would filter by the contact association, sort by the create date of the custom object record (ascending) and return only 1 result (limit:1).
This can return the create date for the first volunteer hour custom object record associated with that contact. Which you can then copy to your contact record.
If you need some further guidance on the custom code part, Iām happy to help. But thought Iād better check you have that functionality in your account first.
I should note, the above suggestions assume that there is only one contact associated with a volunteer hours object record. We may need to take a slightly different approach if that is not the case.
I hope this helps, and do let me know if you need any further guidance.
Thanks,
Kim