Catalog client scripts and record deletion

midsummerbreeze
Giga Contributor

Greetings,

I have a catalog client script that performs validation on a record producer onSubmit.

I am running into a bit of a problem when I attempt to delete a user record from within the catalog client script.

I found the following Servicenow document that discusses limited use of some GlideRecord functionality inside client side scripts, such as client scripts

http://wiki.servicenow.com/index.php?title=Client_Side_GlideRecord#deleteRecord.28responseFunction.2...

However, the code isn't working and I am beginning to believe that the documentation is incorrect and record deletions cannot be performed in client scripts for regular ITIL users.

Below is a snapshot of my catalog client script:

clientscript.png

If I can't perform a delete from a catalog client script, does anyone have any recommendations on how I can accomplish my goal of deleting a user record as an ITIL user when validating a record producer?

Thanks much!

13 REPLIES 13

prashantdharne
Tera Contributor

I usually dont do any server side scripting directly in Client Scripts.



The best SOP for achieving this would be to use Glide Ajax to call the Deletion Script in a Script Include. Now I havent tried deletion via Script include, but I have done other server side operations using Script Include when I need to invoke something from Client Side.



Hope this helps.



http://wiki.servicenow.com/index.php?title=GlideAjax#gsc.tab=0


Abhinay Erra
Giga Sage

You can delete records from client side. The problem here is onSubmit does not support callBack functions.


arnabwa
Giga Guru

Hi Solo,



I would seriously recommend you to do Server Side operations via server side scripting like business rule, Scheduled job or script include.


I strongly believe client scripts would not give you the desired results.



Thanks,


Arnab


igaray
ServiceNow Employee
ServiceNow Employee

Are you even falling into the condition for deletion?