get All vRA Reservation based on BG


Input:
BG: string type // Business group name
 
var tenant = host.tenant;
var BG = bg.toUpperCase();
var hostReservation =[];
var resArr =Server.findAllForType("vCAC:Reservation");
for(var k =0;k < resArr.length;k++){
    //if(tenant.toLowerCase().equals("icds")){
     //   if((resArr[k].displayName.toLowerCase()).indexOf(searchString)< 0){
       //     continue;
      //  }
//}
    System.debug("reservation name is ->"+resArr[k].displayName);
    System.log("Reservation selecton based upon: "+BG);
    if(resArr[k].displayName.indexOf(BG)>-1){
        //System.log("cluster found : "+temp);
         //System.log("Result: "+resArr[k].displayName);
        hostRes =resArr[k].displayName;
        //System.log(hostRes);
        hostReservation.push(hostRes);
        //break;
  }
    }
return hostReservation;
Post a Comment (0)
Previous Post Next Post