Skip to content
DataMiner DoJo

More results...

Generic selectors
Exact matches only
Search in title
Search in content
Post Type Selectors
Search in posts
Search in pages
Search in posts
Search in pages
Log in
Menu
  • Updates & Insights
  • Questions
  • Learning
    • E-learning Courses
    • Empower Replay: Limited Edition
    • Tutorials
    • Open Classroom Training
    • Certification
      • DataMiner Fundamentals
      • DataMiner Configurator
      • DataMiner Automation
      • Scripts & Connectors Developer: HTTP Basics
      • Scripts & Connectors Developer: SNMP Basics
      • Visual Overview – Level 1
      • Verify a certificate
    • Video Library
    • Books We Like
    • >> Go to DataMiner Docs
  • Expert Center
    • Solutions & Use Cases
      • Solutions
      • Use Case Library
    • Markets & Industries
      • Media production
      • Government & defense
      • Content distribution
      • Service providers
      • Partners
      • OSS/BSS
    • Agile
      • Agile Webspace
      • Everything Agile
        • The Agile Manifesto
        • Best Practices
        • Retro Recipes
      • Methodologies
        • The Scrum Framework
        • Kanban
        • Extreme Programming
      • Roles
        • The Product Owner
        • The Agile Coach
        • The Quality & UX Coach (QX)
    • DataMiner DevOps Professional Program
      • About the DevOps Program
      • DataMiner DevOps Support
  • Downloads
  • More
    • DataMiner Releases & Updates
    • Feature Suggestions
    • Climb the leaderboard!
    • Swag Shop
    • Contact
    • Global Feedback Survey
  • PARTNERS
    • All Partners
    • Technology Partners
    • Strategic Partner Program
    • Deal Registration
  • >> Go to dataminer.services

Resource scheduling code example to remove resource from booking

Solved809 views11th July 2023resource scheduling SRM
3
Martijn Vanallemeersch [SLC] [DevOps Member]953 11th July 2023 0 Comments

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

Amer Hodzic [DevOps Member] Answered question 11th July 2023

2 Answers

  • Active
  • Voted
  • Newest
  • Oldest
3
Emmanuel Dal [SLC] [DevOps Member]4.63K Posted 11th July 2023 0 Comments

MArtijn,

Following code sample shows how to retrieve a booking and assign a resource : Silently assigning resource, profile and parameter values | DataMiner Docs

If you use a development environment (ie Visual Studio), you can see that the ServiceReservation object used in the above-mentioned example also has a ‘Unassign’ method that can be used to remove a resource from a booking.

Then following code sample can then do the job :

var requests = new[]
{
new AssignResourceRequest
{
NewResourceId = ResourceGuid
}
};

var sri = SrmManagers.ResourceManager.GetReservationInstance(ReservationGuid) as ServiceReservationInstance;

sri.UnassignResources(engine, requests);

Martijn Vanallemeersch [SLC] [DevOps Member] Selected answer as best 11th July 2023
0
Amer Hodzic [DevOps Member]774 Posted 11th July 2023 0 Comments

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

Amer Hodzic [DevOps Member] Answered question 11th July 2023
Please login to be able to comment or post an answer.

My DevOps rank

DevOps Members get more insights on their profile page.

My user earnings

0 Dojo credits

Spend your credits in our swag shop.

0 Reputation points

Boost your reputation, climb the leaderboard.

Promo banner DataMiner DevOps Professiona Program
DataMiner Integration Studio (DIS)
Empower Katas
Privacy Policy • Terms & Conditions • Contact

© 2025 Skyline Communications. All rights reserved.

DOJO Q&A widget

Can't find what you need?

? Explore the Q&A DataMiner Docs