Validate attachments on a record producer

amadosierra
Kilo Guru

I need to validate if the user has attached at least one document in a record producer and I'm trying to use the following function in the onSubmit Client Script but id doesn't work. I'm using the same function in the form itself and it works there.

 

The call to getUniqueValue() does not return anything. Does anybody knows what applies in this case?

 

function validateAttachments() {
   var sid = g_form.getUniqueValue();
   var gr = new GlideRecord('sys_attachment');

   alert(sid);

   return gr.get('table_sys_id', sid);
}

 

Regards,

 

/Amado Sierra

6 REPLIES 6

solutioningnow
Giga Guru

Hi,



Please check below link:



Mandatory Attachments Order Guide and Catalog Items sharing solution



Please mark answer as correct/helpful



Regards,


Solutioner


Hi solutioner now,



I have tried using the following functions but none of them return a value:



var ord_id = gel('sysparm_cart_edit').value;


var cat_id = gel('sysparm_item_guid').value;



Not sure if gel is still supported, my instance is running Calgary.


Jim Coyne
Kilo Patron

Hi Jim,



This does the trick but I'm still curious as to which method could return the id of the record producer. It seems like gel is no longer supported and there might be other Client Scripts I will need to validate.