Autosave for KB article creation forms

hanaphouse
Giga Guru

By default, the text editor or the article creation forms in Service-Now does not offer auto-save feature. One of our users encountered a problem wherein he was drafting his article and the browser crashed.

To improve user experience, we want to add Auto-Save feature to help users recover their article drafts during any of the following scenario:

  • browser crashed
  • lost internet connection after Submit
  • users who are tired of pressing the Save button on the forms

Has anyone implemented auto-save in forms before? How did you do it?

2 REPLIES 2

lorisd_avanzo
ServiceNow Employee
ServiceNow Employee

That's is very interesting.



I think a Enhancement Request on HI for this functionality will be taken into account.



For a possible development of this by your own, I think you could try with the below approach:



1. Define which are the fields that you want to auto-save in the kb form.


2. With a Client callable Script Include, develop a function that updates a given-in-input kb_knowledge record with the given-in-input data by using GlideRecord.


3(a). Create an onLoad Client Script and set a timeout loops (an example here) in order to save the fields data each X minutes.


3(b). In your timeout loop, invokes the Script Include via GlideAjax in order to save the kb_article data you pass via parameters.



I could not assure the above suggestions will be actually feasible and working fine at the end, but you can try it and let us know then



There are some possible expected obstacles that I can list in advance:


- Synchronous ajax calls can make confusion in a timeout loop. By using a 3-4 minutes iteration in your timeout loop, the asynchronous Ajax should work fine.


- The whole functionality can create some conflict with the ServiceNow User Presence built-in feature. This would require some test after the development of the functionality itself.


- Updating via GlideRecord should work fine for those records that already exist in the database. If the record is not created yet (which is the case of a "create new" form ) I would prefer not to run the auto-save function. Reason: when you will auto-save the record, GlideRecord will query the database in order to find the existing record and then update it, but the record is not there yet, so basically you run a useless ajax call.


g_form.isNewRecord() may be used in order to avoid the ajax call for a new record form.



I hope this helps.



Regards,


Loris


sumeet_n
Kilo Guru

Hello,



Feel free to use below share utility for Autosaving the forms. Please provide your thoughts/suggestions/feedback/reviews. Thank you.



ServiceNow Share