Workflow error : ' GlideAjax is not defined'

abhiyadav2001
Giga Expert

Hi,

 

I am calling a 'script include' in workflow. Script is marked as 'client callable'. This workflow is attached to 'Catalog item'.

 

When I create a request and check workflow, SNow is showing me an error message ; 'GlideAjax is not defined'.

 

Below is my code.. I dont know what am I missing here ?

 

// This script needs to set answer to 'yes' or 'no' to indicate the state of the activity.

//

// For example,

//

//     answer = ifScript();

//

//     function ifScript() {

//           if (condition is true) {

//                 return 'yes';

//           }

//           return 'no';

//     }

 

isManager();

 

          function isManager(){                      

                var ga = new GlideAjax('verifyIfManager'); // script include name

              ga.addParam('sysparm_name', 'checkifManager') // function name to be called

      ga.addParam('sysparm_userName', groupList); // parameter

      ga.addParam('sysparm_groupName',userGroup); // parameter

      ga.getXML(parseAnswer);     } // response

 

// response function

function parseAnswer(response) {

 

var result = response.responseXML.getElementsByTagName("result");

var message = result[0].getAttribute("message");

 

if (message) { return 'yes' ;}

else { return 'no';}

}

1 ACCEPTED SOLUTION

Hi Abhijeet,



                                  Dont pass the parameters. You can write   current.current.userName in includescript .



Wite this below code in Workflow.



Workflow


_____________


gs.include("verifyIfManager");


var verify = new verifyIfManager();


var result = verify.checkifManager();



Write this below code in includescript


_____________________________




checkifManager : function(){


var userName = current.username;


var groupName = current.group_name;



write your code according to your requirement



return answer;


}




Regards,


Harish.


View solution in original post

10 REPLIES 10

Chandan23
Tera Expert

Make a script include using the same script and use


gs.include('script_include_name');