Setting Requirement ID

MagicDraw OpenAPI, scripting related questions and discussions

Moderator: Moderators

Setting Requirement ID

Postby talberi » Wed Nov 14, 2018 7:53 am

I'm writing a script that is supposed to automatically set the ID of a requirement based on a string located in its source property. I'm using the following code:
Code: Select all
SessionManager instance = SessionManager.getInstance();
instance.executeInsideSession("apply id", StereotypesHelper.setStereotypePropertyValue(requirement, requirementStereotype, "Id", idNumber));


where idNumber is a string that I'm trying to set the requirement Id to. This code kinda works. When I run it, the "Id" field in the requirement specification does indeed show the desired idNumber. However, the ID in front of the requirement name in the containment tree does not change. How do I get the ID number displayed next to the requirement name to automatically reflect the newly set string in the "Id" field?
talberi
Forum Beginner
Forum Beginner
 
Posts: 31
Posts Rating:0
Joined: Fri Nov 03, 2017 4:51 am

Re: Setting Requirement ID

Postby talberi » Tue Nov 20, 2018 5:47 am

Any ideas? I searched a little more online to see if I could find an answer. I found a post from a few years ago related to this topic, but the method used in that post appears to be deprecated in the API now, so that didn't really help.
talberi
Forum Beginner
Forum Beginner
 
Posts: 31
Posts Rating:0
Joined: Fri Nov 03, 2017 4:51 am


Return to Programmatic Extendibility

Who is online

Users browsing this forum: No registered users and 0 guests