Distance Field not updating correctly


Been a while since I’ve looked at this but have been having issues with calling the distance from google and updating the field - have got API key and the map function works fine.

Basically, after following threads on this forum, I can get the Distance to update when the rule event is set to ‘Order Added to ticket’ - but I wanted this distance to update at the time when new customers are added (I.e. as the postcode setup configuration does with populating the street names etc.)

Used this to help me - but excluded the delivery fees bit as I won’t be using that:

I’ve tried a few options; including calling the script from the custom field section of the entity type screen (not sure if this is possible but the postcode function is called there) but all my attempts seem to fail.

Wonder if there’s something obvious that I’m missing - or if anyone has any suggestions to perhaps popup/ask question the information when I type in a customers postcode?

Any help will be greatly appreciated, thanks