Extracting string from an email message in case capture and storing as a variable

Hi.

I have the following scenario. There are email messages sent to a support email message which are being converted into cases via the capture functionality in Netsuite.

 

I have a workflow that looks through the incoming message field and finds key words to categorise the case issue (i.e. using the ‘set field value’ as a workflow action)

 

This is working fine.

 

There is a requirement also to search the incoming message for a text string which would be the sales order number. The sales order number is in the format of SO254548.

The extracted sales order number from the body of the email message needs to be stored in a field.

 

According to NS support, this is possible using a script.

I am very new to writing script (I have written only two basic ones till date).

 

What kind of script would I need?

Would this be a workflow action script?

For the actual search of the text string, I have been looking into using REGEXP to extract any alphanumeric string that begins with SO.

However I don’t think I am using Regexp correctly in a  suitescript.

For example, for another script, I have tried to combine REGEXP with split() on a JSON Stringified search result.

I end up getting something like the following

Extracting string from an email message in case capture and storing as a variable

 

This was the lines in the script that produced this

var pattern = new RegExp(“[:]”);
      var n = arrayobj.split(pattern);
      log.debug(“obj”, n);
      log.debug(“n2”, arrayobj.split(pattern, 5));

 

I am not sure where to begin at the moment so would appreciate suggestions on what I should look into to get the result I want.

 

thanks

Rookie Asked on December 2, 2021 in SuiteScript.
Add Comment
0 Answer(s)

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.
  • This site made possible by our sponsors:   Tipalti   Celigo   Limebox   Become a Sponsor