Jump to content

Copy text from details to summary


Dan Munns
 Share

Recommended Posts

Hi all, 

We have a number of auto logged tickets which reference a hostname in the details and I was wondering if there was a way of capturing that info and adding it to the summary. 

The calls are logged from email and I have no control over the formatting of the email or subject line. Somewhere in the body of the email is the hostname which I can pick out with regex but I cant seem to see a way of copying that into the summary.

Any ideas if this is even possible?

@Steve G don't suppose you know? 

Link to comment
Share on other sites

Hi @Dan Munns,

Yeah you should be able to pick that out of the request description and tag on to the end of the request summary in the BPM workflow without too much of a headache.

If you have 2 nodes in your workflow, one to grab the request details, and one to update the summary:

image.png

And the Summary field is populated with:

&[global["flowcode"]["summary"]] : &[global["flowcode"]["description"].match(/(WKS[0-9]{4})/) ? global["flowcode"]["description"].match(/(WKS[0-9]{4})/)[1] : "Not Found"]

This will overwrite the summary with itself, followed by a colon, and then whatever has been matched by your regular expression from the description field. In my example, I'm looking for WKS followed by 4 numeric digits:

image.png

You'll notice that the regex is being done twice - this is just a bit of ternary logic, to make sure that the workflow doesn't fail if the regex doesn't match anything.

Cheers,

Steve

 

  • Like 1
Link to comment
Share on other sites

  • 2 weeks later...

@Steve G I am having a little trouble with this now (although a slightly different scenario)

Basically I need to capture some of the summary (the regex part) to a custom field. So I have done this: 

  • Copy the whole summary into custom field c
  • In the update custom fields node, custom field c:
&[global["flowcode"]["customFieldC"].match(/(Where it happened:.*)/) ? global["flowcode"]["customFieldC"].match(/(Where it happened:.*)/)[1] : "Not Found"]

So that should just over write the data in custom field a with 'Where it happened:' and all the following text to the line break (the regex is working in a checker)

If I do similar in the summary field it works but I cant seem to get it to work with custom fields, no matter which one I choose. 

I have 2 of these I need for the summary (capture the first word, which is the priority and the last sentence, which is the issue) and one from the description (the hostname affected). I was planning on capturing the three parts needed into 3 separate custom fields and then combining them into one summary which will look like "[HIGH] A machine is no longer being protected : WKS123456"

The summary line is like this at the moment: "[HIGH] Alert for Software Package [COMPANY DETAILS ARE HELD HERE]: A machine is no longer being protected : WKS123456

Everything in italics I need to remove and bold I need to add in from the description.

Any ideas?

P.S. I have also noticed that escaped square brackets seem to cause an error, as do unescaped square brackets within the string above. I am assuming because the system sees them as part of the string rather than part of the regex.

 

Link to comment
Share on other sites

Hi @Dan Munns,

Apologies for the late response, just catching up after being on holiday.

I've tried the above, and if I have Where it happened: It happened here! anywhere in Custom C, and have Custom A updated with your matched ternary above, then Custom A is populated with the output of the match as expected?

image.png

What's actually being written in to Custom A for you when you try this?

Cheers,

Steve

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...