<h2>Create a function field</h2><br/><div style="overflow-x:auto"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"><head><meta content="text/html; charset=UTF-8" /><meta name="copyright" content="(C) Copyright 2025" /><meta name="DC.rights.owner" content="(C) Copyright 2025" /><meta name="generator" content="DITA-OT" /><meta name="DC.type" content="task" /><meta name="DC.title" content="Create a function field" /><meta name="abstract" content="Create a function field to be able to group and stack a report by the results of the field's calculation." /><meta name="description" content="Create a function field to be able to group and stack a report by the results of the field's calculation." /><meta name="DC.relation" scheme="URI" content="../../../use/reporting/concept/function-fields-reporting.html" /><meta name="DC.relation" scheme="URI" content="../../../use/performance-analytics/concept/c_performanceAnalyticsAndReporting.html" /><meta name="DC.relation" scheme="URI" content="../../../use/reporting/concept/classic-vis-overview.html" /><meta name="DC.relation" scheme="URI" content="../../../use/reporting/reference/reporting-landing-page.html" /><meta name="DC.relation" scheme="URI" content="../../../use/reporting/concept/c_AdvancedReporting.html" /><meta name="DC.contributor" content="joe.silber" /><meta name="DC.contributor" content="courtney.bradwell" /><meta name="DC.creator" content="ServiceNow" /><meta name="DC.date.created" content="2023-08-03" /><meta name="DC.date.modified" content="2024-02-01" /><meta name="DC.format" content="XHTML" /><meta name="DC.identifier" content="create-function-field" /><link rel="stylesheet" type="text/css" href="../../../CSS/commonltr.css" /><title>Create a function field</title></head><body id="create-function-field"> <div class="breadcrumb"><a class="link" href="../../../use/performance-analytics/concept/c_performanceAnalyticsAndReporting.html" title="Optimize processes and increase productivity with the Platform Analytics applications. These applications include Reporting, Performance Analytics, User Experience Analytics, and Process Mining. Present data through either the Core UI or the Platform Analytics experience.">Analyze and optimize business processes</a> > <a class="link" href="../../../use/reporting/concept/classic-vis-overview.html" title="Present analytics on Core UI dashboards through reports and Performance Analytics widgets. Explore Performance Analytics indicators on the Analytics Hub.">Reporting, dashboards, and Performance Analytics in the Core UI</a> > <a class="link" href="../../../use/reporting/reference/reporting-landing-page.html" title="ServiceNow Reporting enables you to create and distribute reports that show the current state of instance data, such as the number of open incidents of each priority. Reporting functionality is available by default for all tables, except for system tables.">Reporting</a> > <a class="link" href="../../../use/reporting/concept/c_AdvancedReporting.html" title="Learn how to customize report visualizations and the data you report on.">Advanced reporting topics</a> > </div> <h1 class="title topictitle1" id="ariaid-title1">Create a function field</h1> <div class="body taskbody"><p class="shortdesc">Create a function field to be able to group and stack a report by the results of the field's calculation.</p> <div class="section prereq p"> <p class="p">Role required: admin, function_field_admin</p> <p class="p">Each function field requires a label, a return type, and a definition. The definition consists of the operation and one or more fields that the operation is performed on.</p> <div class="note"><span class="notetitle">Note:</span> It is not possible to change the label or the return type after you save a function field. If necessary, deactivate the function field and start again.</div> </div> <ol class="ol steps" id="create-function-field__steps_rdv_l2t_fnb"><li class="li step stepexpand"> <span class="ph cmd">Perform one of the following actions:</span> <ul class="ul choices" id="create-function-field__choices_wjj_z4z_42c"><li class="li choice">On an upgraded instance that has not been fully migrated to <span class="ph">Platform Analytics</span>, navigate to <span class="ph menucascade"><span class="ph uicontrol">All</span> > <span class="ph uicontrol">Reports</span> > <span class="ph uicontrol">Create New</span></span>.</li><li class="li choice">On a new instance or one that has been fully migrated to <span class="ph">Platform Analytics</span>, navigate to <span class="ph menucascade"><span class="ph uicontrol">All</span> > <span class="ph uicontrol">Platform Analytics Administration</span> > <span class="ph uicontrol">Usage and governance</span> > <span class="ph uicontrol">Reports</span></span> and select <span class="ph uicontrol">New</span>.</li></ul> </li><li class="li step stepexpand"> <span class="ph cmd">Select the report you want to add a function field to.</span> <div class="itemgroup info">When you configure a function field on a table, it is available anywhere you use the table on the <span class="ph">Now Platform</span>, including any report on the same table. For example, a function field that calculates the age of open incidents is available for all reports on the incident table.</div> </li><li class="li step stepexpand"> <span class="ph cmd">Open the <span class="ph uicontrol">Configure</span> tab and click <span class="ph uicontrol">Configure function field</span>.</span> </li><li class="li step stepexpand"><strong>Optional: </strong> <span class="ph cmd">Enter the field name in the search bar to see if someone has already created the function field.</span><div class="itemgroup info">Point to the search results to see the function definition.</div> </li><li class="li step stepexpand"> <span class="ph cmd">Click <span class="ph uicontrol">Create</span>.</span> <div class="itemgroup info">There can be a maximum of 20 active function fields on the table the report is based on. If the table already has 20 function fields, a creator of one of the fields or a platform_admin must deactivate or delete one. </div> </li><li class="li step stepexpand"> <span class="ph cmd">Specify the <span class="ph uicontrol">Label</span>.</span><div class="itemgroup info">The label is the name users can see when they group or stack data in a report.</div> </li><li class="li step stepexpand"> <span class="ph cmd">Select the <span class="ph uicontrol">Return type</span>.</span> <div class="itemgroup info">The return type is the kind of information the function produces. For example, the <code class="ph codeph">datediff()</code> function returns a Duration type because it calculates the duration between two dates.<div class="note"><span class="notetitle">Note:</span> You do not see a message if your return type is not a logical result of the function.</div> </div> </li><li class="li step stepexpand"> <span class="ph cmd">Select the Operation.</span> <div class="itemgroup stepresult">The <span class="ph uicontrol">Syntax</span> text box shows the name of the function preceded by <code class="ph codeph">glidefunction:</code>.<p class="p"><img class="image" id="create-function-field__image_exy_ytw_gnb" src="../image/create-ff-01.png" alt="Create function field window with callouts for Label, Return type, and Add Operation. The subtract operation is highlighted." /></p> </div> </li><li class="li step stepexpand"> <span class="ph cmd">Select the fields the function operates on.</span><div class="itemgroup info">Some functions require only one field; some require two or three fields. See <a class="xref" href="../concept/function-fields-reporting.html" title="While regular fields store a value in the database, a function field displays the results of a database query. The function field generates the value based on computations of other fields and constants. You can use these fields in reports and data visualizations as you would other fields.">Report on function fields</a>. Make sure that you separate the fields with commas.</div> </li><li class="li step stepexpand"> <span class="ph cmd">When the syntax is correct, you can save the function field.</span> <div class="itemgroup info">When the syntax is incorrect, you see the message: <samp class="ph systemoutput">Syntax error: Invalid expression</samp>. You may also see other messages.<p class="p"><img class="image" id="create-function-field__image_idc_gww_gnb" src="../image/create-ff-02.png" alt="Create function field window with callouts for Add field and the Syntax is correct message. The Child incidents field is highlighted." /></p> </div> </li></ol> <div class="section result" id="create-function-field__result_w4k_j25_fnb"> <p class="p">Configured function fields appear in the <span class="ph uicontrol">Group by</span> and <span class="ph uicontrol">Additional group by</span> lists after you save the report.</p> Use the created function field it in your report or data visualization configuration. For information on using function fields elsewhere on the <span class="ph">Now Platform</span>, see <a class="xref" href="../build/platform-functions/concept/platform-support-functions.dita/platform-support-functions.html" target="_blank" rel="noopener noreferrer">Function field</a>.</div> </div> <div class="related-links"> <div class="familylinks"> <div class="parentlink"><strong>Parent Topic:</strong> <a class="link" href="../../../use/reporting/concept/function-fields-reporting.html" title="While regular fields store a value in the database, a function field displays the results of a database query. The function field generates the value based on computations of other fields and constants. You can use these fields in reports and data visualizations as you would other fields.">Report on function fields</a></div> </div> </div></body></html></div>