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
    • 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
    • DataMiner Insights
      • Security
      • System Architecture
      • DataMiner Releases & Updates
    • 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

Triggering context menu through automation script

Solved474 views6th August 2024Automation context menu
0
Gerwin van der Kamp [DevOps Enabler]2.91K 2nd August 2024 0 Comments

Hi,

I’m trying to add an item to an table through an context menu:

This is the context menu

<Param id=”1399″>
<Name>TieLines_ContextMenu</Name>
<Description>Context Menu Tielines</Description>
<Type>write</Type>
<Interprete>
<RawType>other</RawType>
<LengthType>next param</LengthType>
<Type>string</Type>
</Interprete>
<Display>
<RTDisplay>true</RTDisplay>
</Display>
<Measurement>
<Type>discreet</Type>
<Discreets>
<Discreet options=”table:singleselection” dependencyValues=”1202?:[value:1202];1203?:[value:1203];1204?:[value:1204];1205?:[value:1205]”>
<Display>Edit…</Display>
<Value>edit</Value>
</Discreet>
<Discreet dependencyValues=”1202;1203;1204;1205;1206;1207?;1208?”>
<Display>Add…</Display>
<Value>add</Value>
</Discreet>
<Discreet options=”table:selection;confirm:The selected Tieline(s) will be deleted permanently.”>
<Display>Delete selected row(s)</Display>
<Value>delete</Value>
</Discreet>
</Discreets>
</Measurement>
</Param>

and this is my code:

public void Run(IEngine engine)
{
Element vmatrix = engine.FindElement(engine.GetDummy(“vmatrix”).Name);
AddTieLine(engine, vmatrix, “4546d0b1-77cd-4070-86a2-485152b01d14”, “17”, “e21c2a9e-29d5-4edd-8697-c7a7e89a1d29”, “1”, “5”);
}

//1202;1203;1204;1205;1206;1207?;1208?
private static void AddTieLine(IEngine engine, Element ThisElement, string sourceGuid, string sourceId, string destinationGuid,string destinationId,string prio)
{
int ContextMenuParameterId = 1399;

SetDataMinerInfoMessage DmInfoMessage = new SetDataMinerInfoMessage
{
DataMinerID = ThisElement.DmaId,
ElementID = ThisElement.ElementId,
Sa2 = new SA
{
Sa = new string[] {
Guid.NewGuid().ToString(),
“add”,
sourceGuid,
destinationGuid,
sourceId,
destinationId,
prio
},
},

Uia1 = new UIA
{
Uia = new uint[] {
(uint)ThisElement.DmaId,
(uint)ThisElement.ElementId,
(uint)ContextMenuParameterId,
},
},
What = 287,
};

Engine.SLNet.SendSingleResponseMessage(DmInfoMessage);
}

to be clear:

1202 string
1203 string
1204 double
1205 double
1206 double

Error:

Script Failure (RBM-AS-RSTielineCrud): System.NullReferenceException: Object reference not set to an instance of an object.
at CManagedAutomation.RunWrapped(CManagedAutomation* , Int32 iCookie, IUnknown* pIAutomation, tagVARIANT* varParameters, tagVARIANT* pvarReturn, String scriptName)
at CManagedAutomation.Run(CManagedAutomation* , Int32 iCookie, Char* bstrScriptName, IUnknown* pIAutomation, tagVARIANT* varParameters, tagVARIANT* varEntryPoint, tagVARIANT* pvarReturn, tagVARIANT* pvarEntryPointResult) (CSharp; 0x80004005h): (see comment for more details)

Appearntly i should use some other call or change something but not shure what i should change.

Marieke Goethals [SLC] [DevOps Catalyst] Selected answer as best 6th August 2024

1 Answer

  • Active
  • Voted
  • Newest
  • Oldest
1
Gerwin van der Kamp [DevOps Enabler]2.91K Posted 2nd August 2024 0 Comments

Right, nothing to do with the context menu:

engine.GetDummy(“vmatrix”).Name -> engine.GetDummy(“vmatrix”).ElementName

and it works 😉

Marieke Goethals [SLC] [DevOps Catalyst] Selected answer as best 6th August 2024
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