My mission is: if the owner of the record is loading the form nothing changes but if not the record's owner loading the form so a X field must be a 'secured field' (can see the field not the value on form and not on advanced search) - is it possible ? I'm not sure that it is possible because on advanced search it will not look at the record's owner data.
A solution that I thought about is when the form is loading I will check if the user is the owner and if so I will give him a security role or add him to a team that has the privilege to my secured field, is it sounds logical?
Is there an other option to solve that case ?
This is a tricky requirement, because we need Field level security enabled for that attribute and based on some field value in a record (owner) - the user will get access to the secured field. But usually FLS will give permission for set of users/team configured in FLS profile. We cannot create a team for each record, Access team cannot be used for this, Security role is not helpful in this scenario.
Similar topic discussed on community forum and this blog post talks about using sdk call to utilize “Share secured fields” functionality.
You can use similar snippet in plugin/workflow/Javascript for sharing it with owner on create/update. This will work in form, advanced find and everywhere.