How To find active & inactive Records in incident table

Kishore8
Kilo Guru

Below Mentioned Code not working.......why can i have calrification about this.

8.1 addActiveQuery

public QueryCondition addActiveQuery()

Adds a filter to return active records.
Returns:
QueryCondition - filter to return active records.
Example:
var inc = new GlideRecord('incident');
inc.addActiveQuery();
inc.query();

addInactiveQuery

public QueryCondition addInactiveQuery()

Adds a filter to return inactive records.
Returns:
QueryCondition - records where the active flag is false.
Example:
var inc = new GlideRecord('incident');
inc.addInactiveQuery();
inc.query();
10 REPLIES 10

How to set Field values " script include to client side" when form   Load

This question is Not Answered.(Mark as assumed answered)


Visitor



Script Include :


var HelloWorld   = Class.create();


HelloWorld .prototype = Object.extendsObject(global.AbstractAjaxProcessor, {



      Approve: function(a) {



                    return "The Server Says Hello " + this.getParameter('sysparm_user_name') + "!" ;


    }



});


client Side OnLoad:                                                                                                                                                                                            



     


function onLoad() {                                                                                                                                                                                                    


    //Type appropriate comment here, and begin script below


    var ga = new GlideAjax('HelloWorld');


ga.addParam('sysparm_name','Approve');


ga.addParam('sysparm_user_name',"Bob");


ga.getXMLWait();


alert(ga.getAnswer());



}



i would like to set values


state=3,category=software, short_description=''welcome to scripting"     i want to write this code in script include and i would like to call that server code when   i load a form   in client side, this values     should set into field.


Chuck Tomasi
Tera Patron

FYI, that's only the 'setup' as an example of each - there's a little more two it if you want to get your hands on the records.



var inc = new GlideRecord('incident');


inc.addActiveQuery();


inc.query();



// This part goes through each active record


while (inc.next()) {


        // do stuff to the record here


}


Pradeep Sharma
ServiceNow Employee
ServiceNow Employee

Sample script to return the count of active incidents.


var inc = new GlideRecord('incident');


inc.addActiveQuery();


inc.query();


gs.log('count of active incidents ' +inc.getRowCount());


its not working.....



find_real_file.png




output:


find_real_file.png


Can you clarify what the objective is here? I'm not clear what the underlying requirement is that is driving this business rule. More information is always help. Please also include what version of ServiceNow you are using. There may be some changes to function name.