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
Kilo 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
Mega 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!