How can I rename a booking from an automation script?
The example below shows how a custom script can be used to rename a booking and associated DMA service.
using System;
using Skyline.DataMiner.Library.Solutions.SRM;
using Skyline.DataMiner.Library.Solutions.SRM.Model.ReservationAction;
using Skyline.DataMiner.Automation;
public class Script
{
public static void Run(Engine engine)
{
// Replace with reservation guid
var ReservationGuid = Guid.NewGuid();
// Replace with Element Name of the Booking Manager
string BookingManagerElementName = "Booking Manager";
var bookingManager = new BookingManager(engine,
engine.FindElement(BookingManagerElementName));
var sri = SrmManagers.ResourceManager.GetReservationInstance(ReservationGuid);
var changeNameInputData = new Skyline.DataMiner.Library.Solutions.SRM.Model.ReservationAction.ChangeNameInputData();
changeNameInputData.Name = "my new booking name";
var result = bookingManager.TryChangeName(engine, ref sri, changeNameInputData);
}
}
Thanks! Working great! Just for other people, if you want to run this silent (without asking for user interaction), you can set this variable:
changeNameInputData.IsSilent = true;