The Zurich release has arrived! Interested in new features and functionalities? Click here for more

Anyone know where the sratchpad data for a record is located ?

poyntzj
Kilo Sage

Anyone know where for a record (in this case a kb_knowledge) article, the scratchpad data is stored ?

I am using a UI Action which loads a UI Page and the user can add a new "valid to" date.

What I then do is reset the workflows and set the KB back to draft

At the moment, the process that runs when the reset is triggered will clear all the dates and reloads the form.   An display Business Rule reads some values from our KB categories and places it in the scratchpad.   A Client Script will take that scratchpad data and obtain the lead times and populates the date fields - all good.

What I am trying to do is to locate this scratchpad data and add the new_valid_to date to it.   Of course a UI page cannot do this.

I am trying desperately not to add a new field to the form and add an extra save step or rewrite the reset process (as it would mean writing a few specific ones)

If it was a workflow, I know I can go into the wf_context table, locate the record and read the value for the field scratchpad and update as needed

Of course, nothing like this exists on the kb_knowledge table.

Cheers

1 ACCEPTED SOLUTION

Hi Brian


The idea was to avoid changing a reset routine, but I have now gone via the route - I knew it would not be simple.



What I wanted to do was to simply store the new "Valid To Date" as selected from the called UI Page on the record


I was then going to modify the routine that populates the proposed dates and make it look at that scratchpad value if it existed.


Problem is that the UI Page has no access to the scratchpad and I cannot see it anywhere.



I guess that unlike with a Workflow where I can see the "scratchpad", the scratchpad for a record is truely temporary and is a pity the UI Page cannot get access to it.


View solution in original post

8 REPLIES 8

Hi Brian, I know about the wf_context and the scatchpad entry - see my first post


The reason I cannot use that is that this a process that will reset all the workflows associated with the KB article so that information is wiped.


I had hoped I could find the equivalent scratchpad data for the main record, but it does seem as if the scratchpad for a normal record is truely temporary so cannot be done.



I had to rewrite the whole reset routine as I had to take into consideration the revised "valid to" date and either clear or not clear depending on what reset is now chosen.     Added some work that I would rather have avoided, but if the customer likes what you create for one requirement and wants it used else where, so be it.



Cheers


Haven't read through all the posts, but perhaps Session client data can help you: Session Client Data - ServiceNow Wiki


OOohhhhh....


Kind of works


I BR sets a value and a Client Script can read it


I can set the value via a UI Page and then have a Client Script read that


I cannot get the value cleared via the Client Script.



Not sure if I can I use it without clearing the data via the Client Script



For a new article


        the value is empty, so populate the sessionData(VT) with the new calculation based on todays date - good


save article


If the user goes into an existing article and changes the valid to date, set this sessionData(VT) to the new date via the UI page   - good, will always do that


or the user just goes and creates a new article


The form loads


The display BR now looks at the sessionData(VT) and sees a date.   How will it know if it is a date it can clear for a new calculation or one to keep from a UI page.



I'd have to see if there is a way for it determine if it is a new record and clear or keep it.....



I have worked around for now, so one to consider going forwards, but it is a nice idea compared using scratchpads.