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
  • Blog
  • Questions
  • Learning
    • Courses
    • Certification
      • DataMiner Operator
      • DataMiner Administrator
      • DataMiner Automation
      • Scripts & Connectors Developer: HTTP Basics
      • Scripts & Connectors Developer: SNMP Basics
      • Visual Overview – Level 1
    • Video Library
    • Books We Like
    • Third-party Courses
    • DevOps Enablement Services
    • Quizzes
  • RESOURCES
  • 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)
  • Expert Hubs
    • DataMiner DevOps Professional Program
    • DataMiner
      • DataMiner Releases & Updates
      • System Architecture
      • Integration Studio
      • Visual Overview
      • Security
    • Technologies
      • CI/CD
      • Converged Interconnect Networks
      • DOCSIS 3.1 / DAA
      • Elasticsearch
      • Kubernetes
      • Telemetry / Flow Monitoring
      • PTP
      • SDN / ST2110 / NMOS
    • Business
      • Software Business models
      • Perpetual Use or Usage-based Services
  • Discover
    • Markets
      • Media production
      • Government & defense
      • Content distribution
      • Service providers
      • Partners
      • OSS/BSS
    • Solutions
    • Use Case Library
    • DataMiner Dashboards
    • DataMiner Downloads
    • DataMiner Modules
      • Core features
      • SRM features
    • DataMiner Apps
    • Professional Services
  • PARTNERS
    • All Partners
    • Technology Partners
    • Strategic Partner Program
    • Deal Registration
  • Pricing
  • More
    • Feature Suggestions
    • Online DataMiner Systems
    • Leaderboard
    • Swag Shop
    • Contact
      • General Inquiries
      • DataMiner DevOps Support
      • Commercial Requests
    • Global Feedback Survey
    • Verify a certificate
  • >> Go to dataminer.services

Resource scheduling code example to remove resource from booking

Solved145 views11th July 2023resource scheduling SRM
3
Martijn Vanallemeersch [SLC] [DevOps Advocate]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 Enabler] Answered question 11th July 2023

2 Answers

  • Active
  • Voted
  • Newest
  • Oldest
3
Emmanuel Dal [SLC] [DevOps Enabler]3.58K 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 Advocate] Selected answer as best 11th July 2023
0
Amer Hodzic [DevOps Enabler]596 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 Enabler] Answered question 11th July 2023
Please login to be able to comment or post an answer.

My Dojo Points

0 Credits
0 Reputation

Question Tag Cloud

adl2099 (54) Alarm Console (53) alarms (69) alarm template (58) API (34) Automation (143) automation scipt (65) Automation script (95) backup (54) Cassandra (141) cloud (36) Connector (44) Correlation (42) Cube (114) Dashboard (134) Dashboards (134) database (64) DataMiner Cube (37) DIS (53) DMS (48) DOM (66) driver (48) DVE (43) Elastic (73) Elasticsearch (99) elements (49) Failover (90) GQI (49) HTTP (45) IDP (54) low code app (68) low code apps (42) MySQL (50) protocol (145) QAction (56) resources (34) security (71) SNMP (55) SRM (266) SRM resources (37) timeout (35) trending (66) upgrade (44) Visio (370) Visual Overview (290)
Privacy Policy • Terms & Conditions • Contact

© 2023 Skyline Communications. All rights reserved.

[ Placeholder content for popup link ] WordPress Download Manager - Best Download Management Plugin