- Access exclusive content
- Connect with peers
- Share your expertise
- Find support resources
05-16-2022 01:55 PM
Greetings,
So I have been pulling rasterized images with the names of the URLs attached into XSOAR and attempting to pipe them into some ServiceNow tickets, but character restrictions are giving the system issues on what files to call during the upload process.
The files are stored as the proper URL context, but filenames cannot have slashes in them, so the file names are being edited with underscores in place of the slashes when the files are generated or when you attempt to download said file, but in XSOAR it still thinks of the file as being named with proper URL context including the slashes, so when I go to upload them in other tasks the files are not found.
I have attempted to replace characters via conditional tasks after the images are generated but the system is limiting me on what contexts I can use to identify them, and I can't seem to pull anything in to transform.
Any ideas?
06-17-2022 11:04 AM
Hey @asawyer,
So I finally got it to work. By moving the re-naming steps into the rasterize process instead of the SN upload process they are finally posing into the ticket with the the full names.
Thanks for all of your help!
05-24-2022 05:41 PM
It looks like you are passing in the URL to the `file_name` input to `rasterize`. The default filename for the `rasterize` result is simply "url.png". Could you try leaving the `file_name` input blank or passing in a different value instead of the URL?
05-26-2022 07:18 AM
Hey @asawyer
The plan is to get the url address in the filename so that when It gets move around or exported to tickets you can tell where the image was from.
Rasterize is working fine with default naming.
05-26-2022 02:38 PM
Hey @Jersey_Mankowski – Ah, I'm tracking now. There are a couple of complications here. The first is the replacement of certain characters, as you mentioned in your original post, and the other is a restriction on filename length (on both the XSOAR and ServiceNow side).
The see what XSOAR changed the filename to, download the result of rasterize and view the filename.
From my testing, the maximum filename length for ServiceNow is 255 characters. So to pass in a valid file_name arg value to servicenow-upload-file:
1. Replace at least the slashes with underscores, so the value is not misinterpreted as a URL (Replace transformer)
2. Truncate the value to 251 characters max to leave room for the file extension – You can do this using the RegexGroups transformer with regex: ^(.{,251})
3. Concat the ".png" file extension
Please give that a try and let us know if it works!
05-27-2022 09:32 AM
Hey @asawyer
I like what you are thinking, and that could be half of it, but with the new transforms I have been seeing an error in the RE.py lib, and some other errors with the replace, I did get it to go through as expected but it's still failing to upload the file and says it does not exist, even when looking up by artifact.
For reference I am doing the file_name transformations in the !servicenow-upload-file task. I have also tried a replace on the slashes to underscore directly after the rasterize, but it would never find anything. I feel like the automatic file renaming by the system is getting these images corrupted or lost somehow, but it's hard to confirm that when I can go download the artifacts.
05-27-2022 04:56 PM
Hey @Jersey_Mankowski – Re: your third screenshot, I get the same error if I don't pass in the file_name arg.
For the example from your last post, could you share the following so we can troubleshoot further?:
1. Screenshots of the exact values and transformers you are using to create the file_name arg, that are leading to the transformer (replace and regex) errors
2. Filename of the rasterize output file when you download it onto your local filesystem
06-02-2022 07:07 AM
So the regex errors are only happening occasionally. Also, I added the 'underscore to hyphen' transform after just having the 'slash to underscore' transform to try and double up and maybe get the system to realize the renaming function since it always seems to look for the file name with the slashes in it and fails the upload when it can't find the file. I also tried it only with the slash transform and was seeing the same results.
06-13-2022 05:55 PM
Hi @Jersey_Mankowski – In your first screenshot with the error, the file_name arg was not passed. From my testing, that arg must be passed in order for the servicenow-upload-file command to succeed. Could you try running the command again with the file_name arg?
06-15-2022 08:34 AM
I am not sure I understand. The second image shows the file_name arguments, also the upload task is looking for the file based on the filename.
What am I missing?
06-15-2022 12:31 PM - edited 06-15-2022 12:32 PM
The second image shows the file_name arg, but the first does not, indicating no file_name arg was actually passed to that command in that first screenshot.
I replicated your example and the following worked for me:
First, I saved the URL to context key url using the Set command:
Then I ran the servicenow-upload-file command, applying the transformers discussed above to the file_name arg value, as shown in the screenshots below:
!servicenow-upload-file id=<SERVICENOW_SYS_ID> file_id=<FILE_ENTRY_ID> file_name=<URL_WITH_TRANSFORMERS> using=<SERVICENOW_INSTANCE_NAME>
Please give that a try and let me know if that works for you.
06-17-2022 11:04 AM
Hey @asawyer,
So I finally got it to work. By moving the re-naming steps into the rasterize process instead of the SN upload process they are finally posing into the ticket with the the full names.
Thanks for all of your help!
Click Accept as Solution to acknowledge that the answer to your question has been provided.
The button appears next to the replies on topics you’ve started. The member who gave the solution and all future visitors to this topic will appreciate it!
These simple actions take just seconds of your time, but go a long way in showing appreciation for community members and the LIVEcommunity as a whole!
The LIVEcommunity thanks you for your participation!