- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-31-2018 09:40 AM
Hello,
Does anyone have examples of function fields? I would like to see how they work and what is the syntax of the function definition.
Thanks,
Chad
Solved! Go to Solution.
- Labels:
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-31-2018 10:16 AM
Hi Chad,
Please find below thread it might help to solve your queries:
1. https://docs.servicenow.com/bundle/kingston-application-development/page/build/platform-functions/task/create-function-field.html
2. https://docs.servicenow.com/bundle/kingston-application-development/page/build/platform-functions/concept/platform-support-functions.html
3. https://docs.servicenow.com/bundle/kingston-release-notes/page/release-notes/servicenow-platform/platform-support-functions-rn.html
Thanks,
Bhojraj

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-31-2018 10:16 AM
Hi Chad,
Please find below thread it might help to solve your queries:
1. https://docs.servicenow.com/bundle/kingston-application-development/page/build/platform-functions/task/create-function-field.html
2. https://docs.servicenow.com/bundle/kingston-application-development/page/build/platform-functions/concept/platform-support-functions.html
3. https://docs.servicenow.com/bundle/kingston-release-notes/page/release-notes/servicenow-platform/platform-support-functions-rn.html
Thanks,
Bhojraj

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-09-2022 11:27 AM
@Bhojraj Dhakate Links now broken. Could you perhaps post an update? Than you.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-31-2018 10:28 AM
Is the GlideDBFunctionBuilder built within the function definition or is that built in a Script Include and then called from the function definition?
var functionBuilder = new GlideDBFunctionBuilder(); var myAddingFunction = functionBuilder.add(); myAddingFunction = functionBuilder.field('order'); myAddingFunction = functionBuilder.field('priority'); myAddingFunction = functionBuilder.build();
Thanks,
Chad
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-22-2018 06:35 PM
Unfortunately the documentation for GlideDBFunctionBuilder is very poor. In some places it is just plain wrong. Whoever wrote the documentation clearly does not understand the builder pattern. This how I use it...
var gr = new GlideRecord('incident');
gr.addActiveQuery();
gr.addQuery(new GlideDBFunctionBuilder().length().field('short_description').build(), '<', 8);
gr.query();
gs.print(gr.getRowCount());
The build() method just returns a String, so it can be completely bypassed like this...
var gr = new GlideRecord('incident');
gr.addActiveQuery();
gr.addQuery('glidefunction:length(short_description)', '<', 8);
gr.query();
gs.print(gr.getRowCount());
This can also be converted to an encoded query and also used in list queries.
eg
var gr = new GlideRecord('incident');
gr.addQuery('active=true^glidefunction:length(short_description)<8');
gr.query();
gs.print(gr.getRowCount());
or
https://dev12345.service-now.com/incident_list.do?sysparm_query=active%3Dtrue%5Eglidefunction%3Alength(short_description)%3C8