function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
lakshya agrawallakshya agrawal 

Question- If an opportunity includes a value in the Mirror Track ID Field the workflow/trigger should evaluate the name and update accordingly

1.Create a trigger or workflow that will replace the piping (‘|’) in the name with an underscore (‘_’)

For example, TMT|NE|OC|AMD|Common Flow Migration|8.23 would be updated to:
TMT_NE_OC_AMD_Common Flow Migration_8.23

HarshHarsh (Salesforce Developers) 
Hi Laksya,

Try the below code
trigger OpportunityMirrorTrackID on Opportunity (before insert, before update) {
    for (Opportunity opportunity : Trigger.new) {
        String mirrorTrackID = opportunity.Mirror_Track_ID__c;
        if (mirrorTrackID != null && mirrorTrackID.contains('|')) {
            mirrorTrackID = mirrorTrackID.replace('|', '_');
            opportunity.Mirror_Track_ID__c = mirrorTrackID;
        }
    }
}

Please mark it as Best Answer if the above information was helpful.

Thanks.