change type of field

rohitshrikhande
Tera Contributor

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 

1 ACCEPTED SOLUTION

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'));
}

 

-Anurag

View solution in original post

7 REPLIES 7

Anurag Tripathi
Mega Patron
Mega Patron

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?

 

-Anurag

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

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 );
}

 

-Anurag

i already tried same as this, while they going in a loop. so i used -if(count.next());
but still ... as it is.
dont know why