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
    • E-learning Courses
    • 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
    • Tutorials
    • 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
    • DataMiner Insights
      • Security
      • Integration Studio
      • System Architecture
      • DataMiner Releases & Updates
      • DataMiner Apps
    • 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
  • Downloads
  • More
    • Feature Suggestions
    • Climb the leaderboard!
    • Swag Shop
    • Contact
      • General Inquiries
      • DataMiner DevOps Support
      • Commercial Requests
    • Global Feedback Survey
  • PARTNERS
    • All Partners
    • Technology Partners
    • Strategic Partner Program
    • Deal Registration
  • >> Go to dataminer.services

DOM – Should it be possible to use the AddOrUpdateFieldValue(…, object value) method call?

Solved1.25K views9th December 2022CrudFailedException DOM DomInstanceSectionInvalidFieldValueTypes FieldDescriptor
1
Michiel Clepkens [SLC] [DevOps Advocate]1.25K 9th December 2022 2 Comments

Hi Dojo

When trying to update a string type DOM instance field using the Skyline.DataMiner.Net.Sections.SectionUtils.AddOrUpdateFieldValue<object>(..., object value) method call, the following exception is thrown. I understand that string type fields cannot be updated using AddOrUpdateFieldValue<object>(..., object value). You should use AddOrUpdateFieldValue<string>(..., string value) to make this work.

But since the actual method signature defines Skyline.DataMiner.Net.Sections.SectionUtils.AddOrUpdateFieldValue<T>(..., T value), I was wondering if it should be possible to use AddOrUpdateFieldValue<object>(..., object value)? There is no object type field available: SectionDefinition object | DataMiner Docs

Skyline.DataMiner.Net.ManagerStore.CrudFailedException: Exception of type 'Skyline.DataMiner.Net.ManagerStore.CrudFailedException' was thrown.
at Skyline.DataMiner.Net.ManagerStore.CrudHelperComponent`1.CheckTraceData(TraceData traceData)
at Skyline.DataMiner.Net.ManagerStore.CrudHelperComponent`1.InnerUpdate(T obj, IAdditionalOperationMeta operationMeta)
at Skyline.DataMiner.Net.ManagerStore.CrudHelperComponent`1.Update(T obj)
at Skyline.DataMiner.Automation.SESSA.CreateBookingFromDom.Run(Engine engine, ExecuteScriptDomActionContext context)
Containing TraceData:
TraceData: (amount = 1)
- ErrorData: (amount = 1)
- ErrorReason: DomInstanceSectionInvalidFieldValueTypes, DomInstance: ...

Thank you in advance!

Kind regards

Michiel Clepkens [SLC] [DevOps Advocate] Selected answer as best 9th December 2022
Lander Vanhaverbeke [SLC] [DevOps Member] commented 9th December 2022

Hi Michiel. Can you explain why you want to put an object into a string DOM field? If it’s already a string, you can cast it to a string. If not, you can call the ToString() method or any other method or property that returns the string you want to set in the DOM field.

Michiel Clepkens [SLC] [DevOps Advocate] commented 9th December 2022

Hi Lander. In my case two fields need to be updated, a string type field and a DateTime type field. I was trying to use the same AddOrUpdateFieldValue method call for this.

1 Answer

  • Active
  • Voted
  • Newest
  • Oldest
3
Lander Vanhaverbeke [SLC] [DevOps Member]1.00K Posted 9th December 2022 3 Comments

The error could be a bit more clear. That being said, I'm not a fan of allowing object for a string field. Assigning an object to a string field could indicate the developer is doing something unintended. It would be dangerous to guess how to convert the object to the string:

  • Is ToString() correctly implemented?
  • How to write a null? Empty string, "NULL", or something else?

For that reason it's safer to let the developer convert it to the correct string before passing it to the AddOrUpdateFieldValue method.

Note: you don't need to specify the generic type, this should be automatically detected by the compiler. So you can write:

section.AddOrUpdateFieldValue(myDatetimeField, DateTime.UTCNow);

section.AddOrUpdateFieldValue(myStringField, "My string");

section.AddOrUpdateFieldValue(myStringField, myObject?.ToString() ?? "NULL");

Michiel Clepkens [SLC] [DevOps Advocate] Selected answer as best 9th December 2022
Michiel Clepkens [SLC] [DevOps Advocate] commented 9th December 2022

Hi Lander. Thank you very much for your answer! You are right. It works perfectly when you define an AddOrUpdateFieldValue method call for each required type. For instance, in my case two fields need to be updated. A string type field and a DateTime type field. So I’ve defined one AddOrUpdateFieldValue(…, dateTimeValue) method call and one AddOrUpdateFieldValue(…, stringValue). But don’t you agree that this approach can be a possible pitfall? As we’re always trying to reuse code as much as possible, the compiler won’t complain if I would define one AddOrUpdateFieldValue(…, objectValue) method call instead.

Lander Vanhaverbeke [SLC] [DevOps Member] commented 9th December 2022

Yes I agree it’s a pity that you won’t see the error at compile time. But allowing objects for string fields only resolves this issue partially. What about setting an object to a DateTime field? Unless the object already is a DateTime, there’s no way to convert it to one. Allowing it for string fields, but not for other fields adds an inconsistency that may add extra confusion.

Michiel Clepkens [SLC] [DevOps Advocate] commented 9th December 2022

Okay that’s clear. Thanks for your explanation!

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

Recent questions

Multiple Set on Table parameters for DVE’s 0 Answers | 1 Vote
DOM Definition relations returned in Definition query 0 Answers | 1 Vote
Alarm Dashboard PDF/CSV Export 1 Answer | 0 Votes

Question Tags

adl2099 (115) alarm (62) Alarm Console (82) alarms (100) alarm template (83) Automation (223) automation scipt (111) Automation script (167) backup (71) Cassandra (180) Connector (108) Correlation (68) Cube (150) Dashboard (194) Dashboards (188) database (83) DataMiner Cube (57) DIS (81) DMS (71) DOM (140) driver (65) DVE (56) Elastic (83) Elasticsearch (115) elements (80) Failover (104) GQI (159) HTTP (76) IDP (74) LCA (152) low code app (166) low code apps (93) lowcodeapps (75) MySQL (53) protocol (203) QAction (83) security (88) services (51) SNMP (86) SRM (337) table (54) trending (87) upgrade (62) Visio (539) Visual Overview (345)
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

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