Change buddypress diplay name when custom field is filled
I am using BuddyBoss platform (a fork of buddypress). In the platform, we can create profile types where members can select a type. On my site I have Personal profiles and business profiles. When a user converts to a business profile, a new section for business information appears. One of the fields is the Business name.
I would like to set it so that if they do not have anything in the “Business Name” field, the display name is their name, but if they do fill in the Business Name, then their display name is changed to their business name.
I have buddypress xprofile fields plugin installed. Can this be done and if so, how?