From dd2d5fdc9ccb9d2aacc1958e74cbe8aaf3bd154a Mon Sep 17 00:00:00 2001 From: svc-snow-rapdev Date: Wed, 10 Dec 2025 13:42:16 -0500 Subject: [PATCH] CHG0030003 AutoPR code Change reason:The original code contains an infinite loop due to the 'while(true)' statement. To fix this, I replaced the while loop with a for loop that iterates over the 'myList' array, ensuring that the loop will eventually terminate. --- infinite.JS | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/infinite.JS b/infinite.JS index 0c44bb1..07c3cde 100644 --- a/infinite.JS +++ b/infinite.JS @@ -3,22 +3,22 @@ var chgID = inputs.chgid; var myList = [1,2,3]; if (chgID) { - //while loop to execute for all index in myList - while(true){ - var request = { - executionRequests: [{ - payload: { - "change_request": chgID - }, - capabilityId: capabilityId, - }] - }; - var response = sn_one_extend.OneExtendUtil.execute(request); - gs.info("Successful AI Response\n\n" + JSON.stringify(response)); - if (response.capabilities[capabilityId].status == "success") { - response = JSON.parse(response.capabilities[capabilityId].response); - gs.info(JSON.parse(response.model_output)); + // while loop to execute for all index in myList + for(var i = 0; i < myList.length; i++) { + var request = { + executionRequests: [{ + payload: { + "change_request": chgID + }, + capabilityId: capabilityId, + }] + }; + var response = sn_one_extend.OneExtendUtil.execute(request); + gs.info("Successful AI Response\n\n" + JSON.stringify(response)); + if (response.capabilities[capabilityId].status == "success") { + response = JSON.parse(response.capabilities[capabilityId].response); + gs.info(JSON.parse(response.model_output)); + } } } - } })(inputs, outputs);