Trim text between characters
Asked by Nodar Vardiashvili:

Hi I want to trim text between "/" to this characters which match "Department".  

Office/Country/Service Operations Division/Customer Service Department/Service Performance and Quality Operations Unit/Service Performance Analyst.  

I want to trim full text which include "department" . I want to get full name "Customer Service Department" and write it new custom field

<br />

<br />


Answers:
author: Patrick Tripodi
body: Hi Nodar,   

I am assuming the text is in the description but please update as you see fit.  

You can do the following:

* Create an automation with whatever your trigger is
* Add an Advanced Branch
  * Smart value: {{description.split("/")}}
  * Variable name: Whatever you want but I used split
* Add a condition as a {{smart value}} compare
  * First value: {{split}}
  * Condition: contains
  * Second value: Department
* Then {{split}} will return Customer Service Department only

![SCR-20240322-tzur.png](https://community.atlassian.com/t5/image/serverpage/image-id/313830iE6646CAB18462C15/image-size/large?v=v2&px=999 "SCR-20240322-tzur.png")![SCR-20240322-tzxw.png](https://community.atlassian.com/t5/image/serverpage/image-id/313831i803712349D05E550/image-size/large?v=v2&px=999 "SCR-20240322-tzxw.png")

Cheers,  

Patrick Tripodi  
GLiNTECH

comments: author: Nodar Vardiashvili
body: I tried to do that in object but not working, it doesn't trim department![Screenshot 2024-03-22 at 6.28.20?PM.png](https://community.atlassian.com/t5/image/serverpage/image-id/313861i6DD607BD60110207/image-size/large?v=v2&px=999 "Screenshot 2024-03-22 at 6.28.20?PM.png")![Screenshot 2024-03-22 at 6.28.49?PM.png](https://community.atlassian.com/t5/image/serverpage/image-id/313862i6326291DAF03A9F1/image-size/large?v=v2&px=999 "Screenshot 2024-03-22 at 6.28.49?PM.png")


author: Nodar Vardiashvili
body: Also i have case when "Adjarabet/Georgia/Customer Success Division/Customer Acquisition Department/Head of Customer Acquisition Department" there is two department in text, how different department name da position name where is department too


author: Patrick Tripodi
body: Looks like the split didn't work since it is still showing the /  

Maybe we can try creating a variable first of the first audit log smart value, and then in the branch, add {{variableName.split("/")}}. Something to try, I noticed sometimes I had to do this with long smart values in branches.  

I assume you are using the same value in the variable as the second audit log.   

I am unsure how you could do anything but check that the split does not contain "Head of" as well to only return the one value.


author: Ste Wright
body: Hi [@Nodar Vardiashvili](/t5/user/viewprofilepage/user-id/1173195)

What's the specific outcome you're looking for here? What will the custom field do (i.e why does it need the information)?

Patrick's answer is a good solution, but it feels like you have a specific need here and it isn't quite clear.

Ste


author: Nodar Vardiashvili
body: Hi [@Ste Wright](/t5/user/viewprofilepage/user-id/1166470) ,

this information coming from ACTIVE DIRECTORY, I need to separate it with name, position, division. I need to record the department separately, the division separately, position seperately. in some division doesnt have the department, some departament doesnt have unit, I need to find out where what is written, and type it into the appropriate field.(departament in department, division in division field and etc)


author: Patrick Tripodi
body: Hi Nodar,  

How did you go with this? Not sure if you tried my second solution with creating a variable first or not?   

Also, if the department, division is in the same spot every time, you can use {{variableName.split("/").get(3)}} (for department) This will get the 4th item in the list, with split() transforming a string into a list.   

<br />


Tags: cloud

jira-service-management

jira-service-management-cloud