- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-24-2024 03:16 AM
Can the field type be changed in the manually created field on the incident form? I have a field "Value" with its field type set to string and i filled data in it too, but I want to change it to an integer. I mistakenly put the field type as a string.
or tell me can we find the MAX value of that same field 'VALUE', with the field type is a string
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-24-2024 03:54 AM - edited ‎10-24-2024 03:55 AM
I tried this on my pdi and it works
I tried with reassignment_count field
var count=new GlideAggregate('incident');
//count.addEncodedQuery('manufacturer=b7e9e843c0a80169009a5a485bb2a2b5');
count.addAggregate('MAX','u_value');
count.setGroup(false);
count.query();
while(count.next()){
gs.print(count.getAggregate('MAX','u_value'));
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-24-2024 03:21 AM - edited ‎10-24-2024 03:21 AM
Hi,
Firstly you need to write something to make sure it only accepts integers
Something like this would help
How to allow integers in the string field for more... - ServiceNow Community
Solved: Field should only accept numeric value - ServiceNow Community
Then you will need to cleanse the data of all records to make sur they only have integers, you can 2write a fix script to do so.
Can you elaborate what do you mean by MAX value? What are you trying to do here?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-24-2024 03:38 AM
Hi Anurag
thanks for reply.
See what I am doing. On my PDI, I have created a new field on an incident form and labelled it "Value." I have put numeric values in every incident form in that field and want to find maximum value form incident. using glideAggregate
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-24-2024 03:44 AM - edited ‎10-24-2024 03:48 AM
Try this
var count = new GlideAggregate('incident');
count.addAggregate('MAX','u_value');
count.query();
while(count.next()){
var max = count.getAggregate('MAX','u_value');
gs.log("MAX = "+ max );
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-24-2024 03:50 AM