userName trimming from non-auth Source

Hi Everyone, would really like your inputs on this. I have a source where it’s reading userName with some extra special chars and its the same for everyone, so lets say for johndoe and johndoe2 the userNames are johndoe~char and johndoe2~char. So i’d like to remove ~char for all users. Also johndoe and johndoe2 are an identity attribute.

So far what I’ve tried:

  1. created a prov policy for modify and disable usage_type and tried to fetch userName not from source but from identityAttribute and use it in my operations.
  2. wrote an afterRule for account aggregation to trim unwanted chars as its same for all users.

End goal: want to trim this username as I have to user it in my http operations for update and disable

Did you set this userName as Account ID aka Native identity ?

Yes I did. Please let me know other possible solutions if any.

In the json payload of my http operation, is there a way to pass userName by updating via .trim() or .replace() on JSON payload itself?