Hi Dojo,
I'm looking for a script to remove resources (resource scheduling), I know we have the following script available in the SRM framework 'SRM_UnassignResourceFromBooking' from SRM 1.2.22
This script is not good for my use case because I want to know if the resource was removed or if problems occurred that resulted in that the resource couldn't removed. It should also be possible to delete resources in ongoing booking as well as past bookings
Off the top of my head this is something you are looking for:
public void Run(Engine engine)
{ engine.SetFlag(RunTimeFlags.NoKeyCaching);
try
{
Guid myReservationGuid = Guid.Parse(engine.GetScriptParam("ReservationGuid").Value);
var bookingManager = new BookingManager(engine, engine.FindElement(BookingManagerElementName));
var instance = SrmManagers.ResourceManager.GetReservationInstance(myReservationGuid);
bookingManager.TryRemoveResourceAndNode(engine, ref instance, Guid.Parse(engine.GetScriptParam("ResourceGuid").Value), Convert.ToInt32(engine.GetScriptParam("NodeId").Value));
}
Hope this helps