Via an automation script we are creating booking reservations. In this reservation we need to have an extra property filled in with a reference Id.
Today we are using an existing booking property (Description), but it would be better to have a custom dedicated one.
How can we create an extra property?
Mieke,
Here is an example :
using System;
using System.Collections.Generic;
using Skyline.DataMiner.Automation;
using Skyline.DataMiner.Library.Reservation;
using Skyline.DataMiner.Library.Solutions.SRM;
public class Script
{
public static void Run(Engine engine)
{
// Replace with reservation guid
var reservationId = Guid.NewGuid();
var properties = new Dictionary<string, object> { { "testproperty", "testvalue" } };
var reservationInstance = SrmManagers.ResourceManager.GetReservationInstance(reservationId);
reservationInstance.UpdateServiceReservationProperties(properties);
}
}
Hi Mieke,
Even if that works, you should only use it when you are creating a new booking or changing it’s date, because that will reschedule your booking.
To update properties you should use what Emmanuel refers (if you are using SRM Standard Solution) otherwise you should use ResourceManagerHelper method public UpdatePropertiesResult SafelyUpdateReservationInstanceProperties(Guid instanceId, JSONSerializableDictionary oldProperties, JSONSerializableDictionary newProperties);
I could get it to work by using the AddOrUpdate on the ReservationInstance we already had.
_reservationInstance = new ReservationInstance(new TimeRangeUtc(bookingInfo.StartTime, bookingInfo.EndTime))
{
Name = bookingInfo.Name,
Status = bookingInfo.Status,
HasAbsoluteQuarantinePriority = true
};
_reservationInstance.Properties.AddOrUpdate(“DomInstanceId”, bookingInfo.DomReference);
….
var resourceManagerHelper = new ResourceManagerHelper(engine.SendSLNetSingleResponseMessage);
resourceManagerHelper.AddOrUpdateReservationInstances(_reservationInstance);