- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-02-2018 04:12 AM
How to get field type on server side(business rule)?
Can anyone please suggest me inside for loop in place of "field name" what can be use so that i can get value of glideElement.
for(var x in current)
{
var glideElement = recObj.getElement("field name");
var descriptor = glideElement.getED();
var result = descriptor.getInternalType();
}
Solved! Go to Solution.
- Labels:
-
Integrations

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-02-2018 02:07 PM
Not sure what you are trying to do. It appears as if you want all field types on a given record. Looking at your script recObj is not defined, so I used current. I also found that the sys_meta field causes the glideElement.getED() method to not work. Taking those into account, here is a script that will give you the field names and types for each field in the current record:
var fArray = [];
for (var x in current) {
if (x != 'sys_meta') {
fArray.push(x);
}
}
for (var f = 0; f < fArray.length; f++) {
gs.print('Field: ' + fArray[f]);
var glideElement = current.getElement(fArray[f]);
var descriptor = glideElement.getED();
var result = descriptor.getInternalType();
gs.print('Type: ' + result);
}
Feel free to modify it for your use.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-02-2018 02:07 PM
Not sure what you are trying to do. It appears as if you want all field types on a given record. Looking at your script recObj is not defined, so I used current. I also found that the sys_meta field causes the glideElement.getED() method to not work. Taking those into account, here is a script that will give you the field names and types for each field in the current record:
var fArray = [];
for (var x in current) {
if (x != 'sys_meta') {
fArray.push(x);
}
}
for (var f = 0; f < fArray.length; f++) {
gs.print('Field: ' + fArray[f]);
var glideElement = current.getElement(fArray[f]);
var descriptor = glideElement.getED();
var result = descriptor.getInternalType();
gs.print('Type: ' + result);
}
Feel free to modify it for your use.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-04-2018 03:54 AM
Could you also please let me know why there is a need to avoid 'sys_meta' in the query.
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-06-2018 04:31 AM
Hi ,
Could you please also explain why there is a need to avoid "sys_meta".
Thanks

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-06-2018 07:05 AM
As I indicated before, it causes an error with one of the functions. Since I do not know why you need to iterate through all of the columns, it is unclear why you even need this. My guess is that is used to store the table and is not even a field you need to concern yourself with. It could be the collection column as is shown in the dictionary for Incident: