I have already asked a similar question that was initially answered: Generate another ID by encoding the Salesforce ID
The suggestion seemed to have fixed the issue but after extensive use and testing I can see that the special characters are less frequent but are still generated from time to time.
Long story short - I want to generate a unique identifier for a record that is not incremental (too simple) and is not the record ID. I intend to use this ID in a url parameter so it needs to be "URL friendly" - this was the issue with my last solution, it contained characters like "/" and "%" which broke the parameter.
EDIT/UPDATE Criteria:
- I want to be able to generate a new ID based on the existing Salesforce ID. This way it will always be unique, as the Salesforce ID is always unique.
- The solution in the above link was perfect. It cerated a new string based on a key and the Salesforce ID field BUT the only downfall was that I couldn't use this generated string as it contained foreign characters that break the parameter in a URL.
- I would love to use the existing solution, but just ensure that no characters that are not URL parameter compatible are not included.
Does anyone have a method of doing this? Preferably in a trigger?