You need to sign in to do that
Don't have an account?
Trigger help - 'substring' on a dynamic position
I"m attempting to strip a specific line of text from a text field. In my current trigger, I can substring the text field but what I really want to do is have the starting position of the substring to be dynamic based on finding specific text. In other words, when I find the text 'subject:', I want to start at subject and get the next x number characters of text. It would be great if I could get all text starting at subject and then ending at another string such as :end...but I'd settle for just retrieving subject: plus 100 characters. Any idea how to use FIND other function to making the starting position of the substring dynamic.
This is my trigger.
1 2 3 4 5 6 7 8 9 | trigger PassLongField on BMCServiceDesk__Incident__c (before update) { for (BMCServiceDesk__Incident__c Incident : System.Trigger.new) { Incident.Description_Strip_Text__c=Incident.BMCServiceDesk__incidentDescription__c.substring(0,100); } } |
You should check to make sure that:
* IncidentDescription__c is not blank (String.isBlank)
* Both String.indexOf functions do not return -1.
All Answers
You should check to make sure that:
* IncidentDescription__c is not blank (String.isBlank)
* Both String.indexOf functions do not return -1.
Perfect..than you!