Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Splitting the string

Arun96
Tera Expert

Hi,

My requirement is to copy whatever is available after '(Additional comments)'.

 

Eg:

2023-02-02 21:08:06 - Arun Vbcd Efghj - 23565645 (Additional comments) kkkkkkkkkkkkkkkkkkkk

In the above example I'm looking to get only 'kkkkkkkkkkkkkkkkkkkk'.

Please guide me how can I achieve this.

I tried to use split() and Regex, but unfortunately I couldn't achieve the required result.

 

Thanks in advance

Arun

 

1 ACCEPTED SOLUTION

Brad Bowman
Kilo Patron
Kilo Patron

It sounds like you are getting the correct journal entry, so assuming it is assigned to a variable named str you should be able to split it like this:

var splitStr = str.split('comments) ')[1];

View solution in original post

2 REPLIES 2

Rahul RJ
Giga Sage

@Arun96  You can get the journal field value from sys_journal_field table where you can get the value

 

You can refer to the article 

Please mark the answer correct/helpful based on Impact.

Regards,

RJ

Brad Bowman
Kilo Patron
Kilo Patron

It sounds like you are getting the correct journal entry, so assuming it is assigned to a variable named str you should be able to split it like this:

var splitStr = str.split('comments) ')[1];