Where to find [Update] [Delete] scripts for Image type fields?

Jake-K
Tera Contributor

I am attempting to locate the scripts for the built-in functions (Update, Delete) associated with Image type fields. The [Delete] option wipes the image but leaves behind a SysID value in the field. I'd like to tweak the script to set the field value to "". Are these functions accessible anywhere on the platform? Thank you for any direction you can provide.

 

 

2 REPLIES 2

-O-
Kilo Patron
Kilo Patron

In the browser function

function deleteUserImage (image_id, table_name, source_field, source_id) {
	var ajax = new GlideAjax("AttachmentAjax");

	ajax.addParam("sysparm_value", image_id);
	ajax.addParam("sysparm_table_name", table_name);
	ajax.addParam("sysparm_source_field", source_field);
	ajax.addParam("sysparm_source_id", source_id);
	ajax.addParam("sysparm_type", "delete");

	ajax.getXML(doNothing);

	var image = $(image_id);

	if (image) {
		image.src="images/s.gif";
		image.alt = "";
	}

	var delspan = $(image_id + "_delete");

	if (delspan)
		delspan.innerHTML = '';

	var addanchor = $(image_id + "_update");

	if (addanchor)
		addanchor.innerHTML = "";

	var imagespan = $(image_id + "_image");

	if (imagespan)
		imagespan.style.visibiity = "hidden";

	var noimagespan = $(image_id + "_noimage");

	if (noimagespan)
		noimagespan.style.visibility = "";

	return false;
};

is executed when "Delete" is pressed.

So you should check Script Include AttachmentAjax.

Which should clear the sys_id too.

Perhaps you are not refreshing the record when checking the sys_id?

Or perhaps the OOB Script Include has been modified and no longer works as designed?

 

(I'm assuming Core UI)

Dustin Spain
Tera Contributor

I am having this issue too.  The sys_id of the image is left behind when pressing delete.  I am going to open a HI case.