This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

DEVELOPERS FORUM - how to get revision for an item

Santhosh - Wednesday, April 6, 2011 6:37 AM:

Hi Community,

I'm trying to find out a method which could get me the revision of an item.

Could someone suggest a method or a way to get revision of an item.

Thanks

Santhosh



Brian - Wednesday, April 6, 2011 11:36 PM:

Hi Santhosh,

Kind of an open question.

Let's assume you are in a method on the client side (Javascript) and you need to get the revision of a Part item whose item_number is "000-0009".

var prt = this.newItem("Part","get");
prt.setAttribute("select","major_rev");
prt.setProperty("item_number","000-0009");
prt = prt.apply();
if ( prt.isError() )
{
    alert(prt.getErrorString());
    return;
}
var rev = prt.getProperty("major_rev");

Hope this helps.

Brian.



Santhosh - Thursday, April 7, 2011 7:43 AM:

Hi Brain,

Could you please explain in what case the Major_Rev changes automatically for a item.

Santhosh



Brian - Thursday, April 7, 2011 5:31 PM:

Hi Santhosh,

It is explained in help - Just Ask Innovator.

Lifecycle states have a check box called "Released'. If an item that is versionable is in a lifecycle state that is "Released" and is edited it will cause a new revision of the item to be created.

Cheers,

Brian.  (Please note the name. It is not BRAIN)



Santhosh - Friday, April 8, 2011 12:56 AM:

Hi Brian,

I'm sorry for misspelling your name, it is a typo.....

Is there a possiblity that we can manually invoke the new version for an item. I'm aware that while creating an Item type we can select "Manual Versioning", but I'm not sure of the way to manual invoke a new version for an item.

Or simply my question is how can we invoke a new version for an item through a server method.

Thanks

Santhosh



Brian - Friday, April 8, 2011 2:32 AM:

Hi Santhosh,

The easiest way to get a new version of an item is to use the "version" action it while it is in a Released state.

c#

Item itm = this.newItem("Part","version");
itm.setID(this.getID());
itm = itm.apply();

Depending on the lifecycle state you are in this will have different results.

If you are in a released state you should get a new Major Rev and a new generation.

If you are not in a released state you should only get a new generation.

Cheers,

Brian.



Santhosh - Friday, April 8, 2011 3:12 AM:

Thanks Brian understood....

Santhosh