The CreatorCon Call for Content is officially open! Get started here.

client callable script include not working in scoped application.

Ubada Barmawar
Giga Guru

Hi everyone,

 

I'm working on a custom table inside scoped application, and I'm trying to execute an OnSubmit client script  which calls script include (defined in same scope), but so far.. either I got null response or no response at all. below are my scripts which are pretty simple but not behaving as expected. basically Im trying to make attachment mandatory on form.

 

client script:

UbadaBarmawar_0-1712603329419.png

 

script include:

UbadaBarmawar_1-1712603542205.png

 have referred multiple community articles and solved queries, nothing seem to work. "sys_attachment" is made available to all scopes.

 

Regards,

Ubada Barmawar.

 

13 REPLIES 13

Prince Arora
Tera Sage

Hello @Ubada Barmawar 

 

GlideAjax encounters issues in onSubmit client scripts because it's an asynchronous call to the server. During this process, the record may get submitted before receiving a response from the server. A better approach would be to move your code to the onChange client script of any field and update a hidden dummy variable on the form. You can then perform your actions based on the value of this dummy variable.

 

If my answer solved your issue, please mark my answer as  Correct & 👍Helpful based on the Impact.

hey I just wanna make attachment mandatory, how come there is no straight forward solution to this.

If atleast an attachment is a dependency to create the record, then I would suggest to create an attachment field as either mandatory or use UI policies to make the field mandatory. You can add a form message to indicate that user need to provide atleast one attached and if there are more, use the clip in the header to attach more.

 

Regards,

Sharad

I have encountered another issue for the attachment filed, Im not able to copy the attachment on field to the data source, so I better use the attachment on form.

 

Copying Attachment from One field to another table... - ServiceNow Community , you may try this.