Skip to Content

can we write a script to read or write a value for standard name attribute

I have a extended attribute, I want to link that extended attribute to the standard attribute already predefined. Like I have created a extended attribute named Business Element Name and used method script to fetch the data from Standard Attribute Title. How to create a method Get/Set Script for Standard Attribute that are predefined.

extended-attr.jpg (103.0 kB)
Add comment
10|10000 characters needed characters exceeded

2 Answers

  • Best Answer
    Posted on May 20 at 11:53 AM

    I think, that the only possibility here is to use Initialize and/or Validate event handlers. Initialize handler is triggered during creation of new object (new Requirement in your case) and Validate is triggered each time you modify some properties of your object and commit these changes. And commiting happens when you: press OK button, press Apply button, switch to another tab in properties window of that requirement or when you change focus to another requirement (in case you edit requirement directly in the document view as shown on your screenshot).

    HTH,

    Ondrej

    Add comment
    10|10000 characters needed characters exceeded

    • Instead of using the Validate event handler (which might activate more often than you expect), consider creating a Model Check that fails if the two properties are different, and include an autofix script that does what Ondrej's script does

  • Posted on May 20 at 11:53 AM

    The script you need is very simple, you just need to set your extended attribute to the value held in the Title property:

    Function %Get%(obj)
    ' Implement your getter method on <obj> here
    ' and return the value
              %Get% = obj.Title
    End Function
    Add comment
    10|10000 characters needed characters exceeded

    • Hi George,

      I really appreciate your help. I am able to get the values from Title to the Extended Attribute "Business_Element_Name". I want Standard Named Attribute "Title" to get the values from the Extended Attribute.

      Thanks & Regards,

      Sai Swaroop Ratakonda