You are viewing limited content. For full access, please sign in.

Question

Question

Workflow Script

asked on December 7, 2016

I used a Script from another user in this group to do a Find/Replace.   I'm teaching myself how to write scripts.  One of the issues I'm having is taking the string "FIRING RANGE LEASE ON DECEMBER 2, 2016" then replace with "FIRING RANGE"   The date will always change.  The next invoice could say "FIRING RANGE LEASE ON DECEMBER 7, 2016"  Any help would be appreciated.  Below is a screen shot of my script editor in workflow.  Thank you.  

 

0 0

Replies

replied on December 7, 2016 Show version history

Repeated calls to replace isn't really the right approach here, I would use either a switch or a series of if/elses.  You could either check for string equality or use something else like StartsWith.  Something like:

if subme = "WATER SAMPLE" then
    subme = "WS"
else if subme = "STORMWATER" then
    subme = "SW"
else if subme.StartsWith("FIRING RANGE LEASE") then
    subme = "FIRING RANGE"
end if

 

0 0
replied on December 7, 2016

Brian,

Thank you for the information.  I tried to make it work in the workflow script editor but was not able to.  How would this look in the workflow script editor?

0 0
replied on December 7, 2016

It would be the same in the Script Editor. What exactly did you have in there? Did you get any errors?

0 0
replied on December 8, 2016

Hi Miruna,

Here are the errors I receiving.

0 0
replied on December 8, 2016 Show version history

My code snippet isn't meant to entirely replace yours, I intended it as an example to show an alternate approach.  If you are going to use the variable "subme" then you still need to declare and initialize it.  You'll also need to include all of the other cases that I left out, and you'll still need to update the token value at the end.

My VB is a little rusty, I had "end" where an "end if" is required, I've updated my code.

0 0
You are not allowed to follow up in this post.

Sign in to reply to this post.