Examples of function fields

Chad Wilhelm1
Tera Expert

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

1 ACCEPTED SOLUTION

Bhojraj Dhakate
Tera Expert

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

View solution in original post

8 REPLIES 8

Hi James,

I am trying to use a function field (mostly for reporting purposes) as an option so that I do not have to add a column to the database. I need to do conditional logic on this new function Field. The name of my field is Billable. I want it to be a True/False field. This field needs to be able to do conditional logic and return true if it satisfies certain conditions and false if it does not. The conditional logic should return if a particular item of work is billable or not.

I have been able to use a function field with the example given below: glidefunction:concat(short_description, ' ', caller_id.name)

However, I think I need to try something with Scoped GlideDBFunctionBuilder but do not understand the documentation or how to use it. My questions:

Do you have an example using GlideRecord - addFunction(Object function)?

Thanks,

Ken Hartwigsen

Where does the code you wrote above go? Does it go in the function definition or in a script include?

 

Do you have any working code using function fields other than something like

glidefunction:concat(string1,string2)?

 

Thanks,

Ken

Hi Ken,

What I am demonstrating is how to use Db functions to perform Glide queries. For example "show me all active incidents where the length of the short description is less than 8 characters".

I am not demonstrating how to create a function field on a table. I do not have any experience of doing that.

cheers James

SR2
Tera Contributor

Hello everyone,

Thanks for your valuable information. I have a small requirement regarding function field.

There are some operations like concat(), add(), dayofweek().

In the same way can we get a year from a date/time field and store in function field.

ex: the date is 2022-02-23, the value in the function field should be 2022.

Thanks.