How to concatenate three fields in a different created fields

Koyel Guha
Tera Contributor

Hello Team,

I am new to service now scripting and need help to concatenate 3 fields in a different or unique filed.

I have created a table named :My Table [u_my_table]  with few fields mentioned below : 

Incident Number  => Reference Type from the incident tabe 

Priority => String Type 

SLA Definition => Reference Type from contract_sla table

Assignment Group => Reference Type -Group from incident table

Unique Key [NEW FIELD]  = > Concatenate (Incident Number, Priority, SLA Definition)  

Can anybody guide me with the scrip to concatenate these three fields ? And also am not getting any data to the new table create (u_my_table)  ?

 

Kindly help me with the script for the same.

 

Thank You.

 

 

 

 

 

 

1 ACCEPTED SOLUTION

Abhinay Erra
Giga Sage

Write a before business rule

when to run: Before insert and update

Conditions: Incident Number Changes OR SLA Definition changes OR Priority changes

Script: current.<field name of unique key>=current.<field name of incident number>.getDisplayValue()+current.priority.getDisplayValue()+current.<field name of sla definition>.getDisplayValue();

View solution in original post

3 REPLIES 3

robertmaxwell
Mega Expert

If you are using Kingston you can make use of function fields Create a new field from the table definition Mark Function field true In the function definition set it as glideFunction:concat([fieldName], ' ',[fieldName], ' ',[fieldName])

 Above, the ' ' will provide a single white space. Remove those to have the concatenation appear as one single string with no spaces. Example [fieldName],[fieldName],[fieldName]

How, when, and what data do you want on your new table? 

 

 

Edit: syntax correction

Functions are a good use here, but that isn't quite the right syntax.  Be sure to check the docs.

 

If a GlideFunction doesn't work, try a BR that concatenates these into a new field when any of these changes.  That way the calculation is only executed when there is a change.

Abhinay Erra
Giga Sage

Write a before business rule

when to run: Before insert and update

Conditions: Incident Number Changes OR SLA Definition changes OR Priority changes

Script: current.<field name of unique key>=current.<field name of incident number>.getDisplayValue()+current.priority.getDisplayValue()+current.<field name of sla definition>.getDisplayValue();