Welcome to Community Week 2025! Join us to learn, connect, and be recognized as we celebrate the spirit of Community and the power of AI. Get the details  

Function Field

MiY
Tera Contributor

I would like to create a function field in the Request Item table to check for the presence or absence of attachments.

I set up the function definition as shown below to check whether a file is attached to the attachment variable.

 glidefunction:length(variables.attachment);

However, I get the error "invalid function." How can I achieve this? What value should I set in the function definition?

6 REPLIES 6

RaghavSh
Mega Patron

I believe simple g_form.getValue should work here.

 

var att = g_form.getValue('attachment_var_name');
if(att) 
{
// your ogic
}

Raghav
MVP 2023
LinkedIn

Bhuvan
Giga Patron

@MiY 

 

If you are looking to create function field in report designer, this is not doable. Dot walking is not supported with function fields. Attachments are created in sys_attachment table and linked to sc_req_item record when a file is uploaded as an attachment.

 

Refer supported functions that can be used from below link,

 

https://www.servicenow.com/docs/bundle/zurich-now-intelligence/page/use/reporting/task/configure-fun...

 

https://www.servicenow.com/docs/bundle/zurich-now-intelligence/page/use/reporting/concept/function-f...

 

If this helped to answer your query, please mark it helpful & accept the solution.

 

Thanks,

Bhuvan

Bhimashankar H
Mega Sage

Hi @MiY ,

 

If you want to check if attachmentis added or not, then you can do it by different ways, 

This using script include, refer this article KB0723548 - Check Attachment .

 

Check out this article Service Portal Catalog Items: Hide Attachment / Mandatory Attachment  

Verify attachment count in service portal or native platform view 

 

Attachment variable and making attachment with zero code ITSM Article - Attachment Mandatory/Check Attachment 

 

Thanks,
Bhimashankar H

 

-------------------------------------------------------------------------------------------------
If my response points you in the right directions, please consider marking it as 'Helpful' & 'Correct'. Thanks!

Rafael Batistot
Kilo Patron

Hi @MiY 

 

This document might help you 

 

https://www.servicenow.com/docs/bundle/zurich-now-intelligence/page/use/reporting/task/create-functi...

If you found this response helpful, please mark it as Helpful. If it fully answered your question, consider marking it as Correct. Doing so helps other users find accurate and useful information more easily.