save image to a record : ServiceNow - javascript

I have a journal field on my form. I am copy pasting images from a webpage to this journal field. Unfortunately these images are saved as references to that webpage. Is there a way that I can save these images to that form(or record)?

Need more info to help you. What version are you running?
Assuming Geneva or later, adding an image attachment to a record automatically makes it show up in the activity log. You cannot place an image in a journal field directly.

Related

Unable to fetch id valuse in Java script

enter image description here
enter image description here
enter image description here
Hi there,
I am trying to create two buttons save and update where the difference between them is the save button will save the data navigate to the back page and the update button will save the data and will stay on the same page.
I am not sure where I am going wrong but I am unable to fetch the id in the if condition of Java Script.
Thanks in advance.

HTML & Javascript text changing

i was wondering how i could do the following:
I get the input from the user using form(okay fine)
i take that input and store it as a variable in javascript(got it).
The variable i just saved changes the text of another page in the website (it permanently changes the text of that webpage and isn't depended on the js variable of that file anymore(it can also import the text into the web page if need be if possible))
for eg:- enter image description here
Here the user enters the details let's say the name for now
and then in the second img the text of the website changes, and when i download the second img website which doesn't hold the original js which stored the variable, it still shows the text as it might have stored the text in the file locally using js or something.
[2]: https://i.stack.imgur.com/4nZCD.png
Please help me out.
In my experience, the best way to store information from page-to-page is through local storage.
Local storage persists from page to page, while JavaScript variables are cleared out, and cookies can be un-reliable based on the response from the server they are sent too.
In your function that takes the user input, write something along the lines of:
localStorage.setItem('myCat', 'Tom');
And to retrieve this information, you can reference it like:
const cat = localStorage.getItem('myCat');
Here is a reference: https://developer.mozilla.org/en-US/docs/Web/API/Window/localStorage

How can I remove specific images from a file input?

I am creating a product registration using php and using vanilla js to get the selected images from the file input and preview them in the screen. Now I want to provide a way for the user to remove unwanted images before submitting the form.
The form has the images and other inputs for the title of the product, description, price and category selection.
I have seen so far in many places people telling that you can use a dataTransfer object to store the images and remove from the dataTransfer and after making the file input (=) the dataTransfer but none of the answers I've found so far have worked.
Is there a way to remove images from the file input once they are selected?
#CBroe I'm talking about Data Transfer in js (https://developer.mozilla.org/en-US/docs/Web/API/DataTransfer). Thank you for your comment. If it's not possible to remove files from the filelist of the file input I will have to store those data somewhere and create an arbitrary submission of the form.
Thank you
#RiggsFolly the user clicks on the file input <input type="file" multiple> and selects (let's say) 4 images. These images are read by the js script and displayed on the screen, as a preview. I want to provide a small garbage icon on top of each image and let the user be able to remove specific images.
I wanted to know if it's possible to remove the selected images from the files inserted on the file input. Then I would remove the image using the name of the file as reference (or any other reference). I just never found a way to remove files from the input file.

Automatically download a file from a website every day

I need to download a file from this website: "https://es.investing.com/indices/merv-historical-data", automatically and every single day. To download the file I must click a js button that says "Descargar Datos" (or "Download Data").
I can't find something that works for this, and I would really appreciate it if someone could help me.
If you want the data automatically exported in to Excel Spreadsheets, you can actually pull a table from a website. I found this article about how to do it:
After opening a new sheet in Excel, click "Data" in the navigator bar
All the way to the left, there should be a button that says "From Web"
After clicking it, it will ask for a URL. Just copy-paste "https://es.investing.com/indices/merv-historical-data" (without quotations)
The first time it might ask if you want to establish an anonymous connection, just click ok.
Excel will then try to connect to the website, give it a few minutes.
You will then get a file drop down with a bunch of tables. Table 0 is what you are probably looking for. Select it and then click "Load" in the bottom right corner.
This is basically what that button did on the website. It just compiled the data and then invoked a download.

Download file using javascript

I have an application that runs to print documents. there is a tree view and grid control in the page. The treeview is enabled with the check box. there is another checkbox in the grid. based on the selection i create pdf using itextsharp and want print , download email etc.
i did it but when it down loads , I need the controls to be cleared. this is not happening even i wrote the code to clear. i think the issue may be with the usage of memory stream. So what i am doing is create pdf and saved to a location. So how can I do it with javascript (the download function). My ultimate aim is to clear the controls.
Regards,
Sivajith S.

Categories

Resources