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

Get instanceid from instanceid object

Solved980 views21st November 2022Automation script DOM
1
Gerwin van der Kamp [DevOps Enabler]2.91K 18th November 2022 0 Comments

Hi,

I’m building an automation script that get fed an name which is then lookup op in an DOM definition:

var customerfilter = DomInstanceExposers.FieldValues.DomInstanceField(McrCustomerIds.Fields.General.CompanyName()).Equal(jsonJob.customer);
var mcrCustomerList = mcrCustomerdomHelper.DomInstances.Read(customerfilter);
if (mcrCustomerList.Count < 1)
{
error = error + “Customer doesn’t exist” + System.Environment.NewLine;
}
else if (mcrCustomerList.Count > 1)
{
error = error + “Multiple customers found with this name, please define name beter” + System.Environment.NewLine;
}

Al i need is the guid of that instance to be inserted into an other DOM definition, now i ran into an issue since i need to provide an GUID. so i load the first entry.

DomInstanceId customer = mcrCustomerList[0].ID;

But this returns an DomInstanceId instead of an GUID. How can i go from this to an guid? i tried:

mcrCustomerList[0].ID.ToString(); (returns cryptic C-sharp error which is nowhere defined or findable)

Convert.ToString(mcrCustomerList[0].ID); which yields an string with the correct id however it is enclosed by another string: DomInstanceId[b78bfed1-ab88-4ba8-b468-c4bb2c809f12]

Now i can do some formating on the later, but i suspect there is an proper way to get the GUID without resorting to regex.

Sebastiaan Dumoulein [SLC] [DevOps Enabler] Answered question 19th November 2022

1 Answer

  • Active
  • Voted
  • Newest
  • Oldest
5
Sebastiaan Dumoulein [SLC] [DevOps Enabler]12.80K Posted 19th November 2022 1 Comment

The DOMInstanceID class has two public properties:

  • Guid Id
  • String ModuleId

So in your case you can get the underlying Guid by using mcrCustomerList[0].ID.Id.

Note that the ModuleId is useful when you don’t know the underlying module which contains the DOM instance. However, in most situations the module is known upfront and there is no need to use the ModuleId.

Sebastiaan Dumoulein [SLC] [DevOps Enabler] Answered question 19th November 2022
Gerwin van der Kamp commented 21st November 2022

Ah yes that worked

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