Sync Profile Data to Location Field?

We use the Location field in the Profile editor to set the office location (building) on our fac/staff profiles. We always set that manually. We have never had that data anywhere else outside of LiveWhale. We are beginning a project to start storing office location information in Banner, or some other authoritative database, and would like to eventually sync that back into LiveWhale. But Location is not a syncable field on profile types. Has anyone else dealt with this? Is there a way to automatically set a Profile’s location based on data from an external data source?

Thanks Jon – I see what you mean, I don’t think there’s currently any logic in the Profile Data Source sync process to handle the Location field. We can add it to the roadmap for core, but in the meantime I wonder if setting it to a custom profile field for the short-term would work, and then using an onAfterSave handler you could check for profiles_123 (custom location field) being different from Location and then run an $_LW->update() if so to bring them into alignment? That might be one way to accomplish what you’re after without waiting for a core change.

That might work, but I assume we would have to save all profiles to get them to run the update(). Would there be a way to run the update() after each automatic sync? Or does onAfterSave actually trigger after syncs too?

Thanks Jon – good point, I checked the code and it looks like onAfterUpdate($type, $id) is the handler that does get called after each auto-sync of of those profile fields, so I bet that would work? You could use the $id to check a $_LW->read('profiles', $id) result to compare location data.

That’s good to know. When we get to the point of syncing location data (probably in the fall), I will revisit this and reach out if we need any help.

Thanks for your help.