How to extract string value from description and paste in short description of ticket.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-07-2018 01:52 AM
RITM description contains in the following format:
Employee Name: Swarnarghya Ghosh Or any name it might have
Employee Email: swarnarghya.ghosh@#######.com or any email ID
Manager: XYZ
I want to copy the employee name and manager name in the task description of the RITM.
Please help me how to extract the name from short description
- Labels:
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-07-2018 02:42 AM
Hi,
you have to just cross-bind the employee name and manager into the RITM. On the workflow that you use for this particular item, just use Run Script activity and use something like:
current.short_description=current.variables.<EMPLOYEE_NAME> + " " + current.variables.<MANAGER>;
where you should replace the EMPLOYEE_NAME and MANAGER with your real variables
Cheers,
Joro
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-07-2018 02:53 AM
We are not using any variables here.
Please let me know if you can do it with the help of split method();

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-07-2018 02:54 AM
Create a 'Before' 'Insert/Update' business rule on your 'sc_req_item' table with a condition of 'Description contains Employee Name and Description contains Manager'. You can do this with the condition builder on your business rule form. Then use this as your script...
(function executeRule(current, previous /*null when async*/) {
// Parse description info
// Key variables
var employeeKey = 'Employee Name: ';
var managerKey = 'Manager: ';
// Split the description into an array of individual lines
var descriptionArr = current.description.split('\n');
// Get employee info from first item in array
var employee = descriptionArr[0].substring(descriptionArr[0].indexOf(employeeKey) + employeeKey.length, descriptionArr[0].length);
// Get manager info from third item in array
var manager = descriptionArr[2].substring(descriptionArr[2].indexOf(managerKey) + managerKey.length, descriptionArr[2].length);
current.short_description = 'Employee: ' + employee + ' Manager: ' + manager;
})(current, previous);
Please mark this answer correct if I've answered your question. Thanks!