- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-18-2020 10:52 AM
Hi Community,
I have a question regarding the use of scripts in Flow Designer. I have a script that creates and updates an incoming email into a incident ticket. The last part of the flow I have added an update action for the incident with correlation ID so that when a supplier sends their correlation id in the email subject line this populates the correlation id field in servicenow ticket and I need to write a one line script using the f(x) box.
So far I am able to pull the entire subject line into the correlation box, but I only need the number,
Appreciated your assistance
Many thanks
Steve
Solved! Go to Solution.
- Labels:
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-18-2020 09:38 PM
Hi
Below, I just created a test-flow, which adds the String "OK" to the field "Info" and writes it back to the field "Info2". Same way you can do with the "substring" to cut out the right-most characters from my answer above.
Note, that my example is NOT on an "inbound mail action", but let me know if you can sort out the problem.
Let me know if that answers your question and mark my answer as correct and helpful.
BR
Dirk

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-18-2020 10:16 PM
Hi
Just one more information to make the example complete.
I just tested it on my side and it works perfect. I was not using the "Incident" table, but a custom test table "Down RITM", that I use a lot for testing purposes...
The screenshot below shows the Flow Designer flow that I created for demonstration purposes for you.
(1) As the Action in my flow, I CREATE a new Record in my custom table (just like you did in your first step with the Incident).
(2) This will create the data pill that i will use in the Update Record action in the next step
(3) Drag the newly created Record (data pill) into the "Update Record" Action and click on the "f(x)" icon to open the script.
(4) My script looks different to yours, because I can access details from the inbound email by using the "fd_data" object like shown in the screenshot. You should also use it in that way to get the details from your Subject of the email.
(5) MAKE SURE NOT to click the "f(x)" icon AGAIN!!! If you do that, you will DEACTIVATE the "f(x)". This is a TOOGLE button. Just click on the "DONE" button.
If you later want to open the script again, DO NOT CLICK THE "f(x)" button, but instead, click on the caret "^" button!!!
Try out with the example shown above. That way, you should be able to solve your issue.
Let me know if that answers your question and mark my answer as correct and helpful.
BR
Dirk

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-19-2020 05:54 AM
Hi
Do you have any update on my detailed explanation?
Thanks for some response and/or marking as correct and helpful.
BR
Dirk
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-19-2020 06:01 AM
Dirk,
Thank you for your explanation, however this seems to not be working. Before I had the subject coming into the correlation ID, now I am unable to get that.
Just still trying a few different scripts
Kind regards
Steve

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-19-2020 06:05 AM
Can you submit some screenshots of your flow.
I tried mine, and it works as expected, which means, that this must work on your site as well.
Did you try to "replay" my solution, to see that this at least works, and afterwards try to adopt to your scenario.
Especially look at the script part, where I access completely different variables, than you do.
Let me know.
BR
Dirk
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-19-2020 07:17 AM
Dirk,
Thank you, marked as correct, had to jiggle about with the code due to flow designer.
Many thanks for your help.
Steve