script ox for Autonumber of item object/CR object based on a affected item or relataionship tab pbject number?

we want autonumber of item object/Change request object based on relation ship object or affected item object, we need to get item number and set new auto number to new object

Add Comment
1 Answer(s)

Hi Mahign,

Your query is not fully clear to me. However, based on my understanding, below is a sample code to get the next autonumber of a Part which is in the affected items of a ECO. Similar thing can be done for Relationships tab also. Here my sample ECO contained only one row so I haven’t iterated over the table in a loop.

<br />String next = "";<br />IChange change = (IChange)session.getObject(IChange.OBJECT_TYPE, "C00004");<br /> IItem item = (IItem) change.getTable(ChangeConstants.TABLE_AFFECTEDITEMS).getReferentIterator().next();<br /> for(IAutoNumber an : item.getAgileClass().getAutoNumberSources()){<br />        next = an.getNextNumber();<br /> }<br />Map&lt;Integer, String&gt; attributes = new HashMap&lt;Integer, String&gt;();<br /> attributes.put(ItemConstants.ATT_TITLE_BLOCK_NUMBER, next);<br /> session.createObject(IItem.OBJECT_TYPE, attributes);<br />

When you get the next autonumber i.e. String next, you can use it to create another part. Hope this helps.

Agile Expert Answered on July 6, 2018.

to be precise, i want script code for ECR/ECO to custom auto number  same as affected item, first row or relationship code first row

on July 7, 2018.
Add Comment

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.