Developers » Scripting Code Samples » Call Script with Parameters


Call Script with Parameters

Notice: We are currently working to improve this content. Once revisions are finalized, we will add the article to the Recently Updated Articles section on the product's Documentation Home page. Learn more.

You can call an asynchronous script with parameters by setting the context parameters, such as in the following example:

def c = resp.getCase('new feature-a-124');
def usr = resp.getUser('admin');
def today = new Date(); 

def script = resp.script.get('my_script')  

script.setContextParam('currentCase', c)  
script.setContextParam('currentUser', usr)  

//To define a custom parameter, use the following syntax:
//script.setContextParam('someYourParameter', yourParameterObject)  

//Example of a custom parameter:
/script.setContextParam('today ', today )  


Related Articles