- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-06-2014 03:41 AM
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';}
}
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-06-2014 05:45 AM
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-06-2014 05:18 AM
Make a script include using the same script and use
gs.include('script_include_name');