- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-17-2020 03:11 PM
I created an integer variable called "u_automation_launch_count" with the purpose of counting the number of times a business rule runs that launches an API for a particular incident. The business rule may run multiple times for the incident based on statuses. Below are the business rule specs, and everything works with the exception of being able to increment the value of "u_automation_launch_count"
Code:
current.u_automation_launch_count += 1;
try {
var r = new sn_ws.RESTMessageV2('Bamboo API', 'Bamboo POST');
r.setStringParameter("sys_id",current.sys_id);
r.setStringParameter("number",current.number);
var response = r.execute();
var responseBody = response.getBody();
var httpStatus = response.getStatusCode();
}
catch(ex) {
var message = ex.message;
}
Any assistance would be appreciated!
Solved! Go to Solution.
- Labels:
-
Integrations
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-17-2020 03:18 PM
Hello Kowens,
i guess current.update(); is missing.
Try below code.
current.u_automation_launch_count += 1;
current.update();
try {
var r = new sn_ws.RESTMessageV2('Bamboo API', 'Bamboo POST');
r.setStringParameter("sys_id",current.sys_id);
r.setStringParameter("number",current.number);
var response = r.execute();
var responseBody = response.getBody();
var httpStatus = response.getStatusCode();
}
catch(ex) {
var message = ex.message;
}
Hope this helps!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-17-2020 03:18 PM
Hello Kowens,
i guess current.update(); is missing.
Try below code.
current.u_automation_launch_count += 1;
current.update();
try {
var r = new sn_ws.RESTMessageV2('Bamboo API', 'Bamboo POST');
r.setStringParameter("sys_id",current.sys_id);
r.setStringParameter("number",current.number);
var response = r.execute();
var responseBody = response.getBody();
var httpStatus = response.getStatusCode();
}
catch(ex) {
var message = ex.message;
}
Hope this helps!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-17-2020 03:24 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-18-2020 06:34 AM
Thank you Yogi! As I thought, it was one little thing...Much appreciated!!