Current And changed state names

Current And changed state names

amitnkukanur
Collaborator Collaborator
1,666 Views
8 Replies
Message 1 of 9

Current And changed state names

amitnkukanur
Collaborator
Collaborator

i am trying to figure out how to get the current state name and changed state name..

i used UpdateFileLifecycleStateEvents_Pre and Post but none of them are triggering events to fetch the label names. 

 

Any body has idea

 

 

Senior Software Engineer
0 Likes
1,667 Views
8 Replies
Replies (8)
Message 2 of 9

Redmond.D
Autodesk
Autodesk

Can you clarify the problem. 

Are you saying that the Pre and Post events are not firing?  Or are you saying that they are fireing but you don't know how to look up the state names from the EventArgs?

 

 

 



Doug Redmond
Software Engineer
Autodesk, Inc.

0 Likes
Message 3 of 9

amitnkukanur
Collaborator
Collaborator

Thanks Doug Redmond for reply, the issue is in Pre and Post events are not at all firing and if they fire how you fetch the state names. Currently i am able to fetch the previous State name, but when the state name is changed to new one, i am unable to fetch the name of state

Senior Software Engineer
0 Likes
Message 4 of 9

Redmond.D
Autodesk
Autodesk

So, you have two problems...

 

Problem 1: Events not firing

Make sure that your app is loading.  Put a breakpoint in the OnLoad method to verify.  See this article for more information on troubleshooting load errors.

 

Problem 2:  Figuring out the state name

The FROM information can be found on the File objects.  GetLatestFileByMasterId and GetFilesByMasterId are the functions to use.

The TO information can be found by calling LifeCycleService.GetLifeCycleStatesByIds

 



Doug Redmond
Software Engineer
Autodesk, Inc.

0 Likes
Message 5 of 9

amitnkukanur
Collaborator
Collaborator

In which module i would file LifeCycleService

Senior Software Engineer
0 Likes
Message 6 of 9

Redmond.D
Autodesk
Autodesk

Sorry, that's a new service in Vault 2013.  If you are using Vault 2012, the function is in DocumentServiceExtensions.



Doug Redmond
Software Engineer
Autodesk, Inc.

0 Likes
Message 7 of 9

amitnkukanur
Collaborator
Collaborator

Hi Doug, the GetLifeCycleStatesByIds still points to previous state name, when i change the life cycle and click OK, the GetLifeCycleStatesByIds still refer to previous state. 

Senior Software Engineer
0 Likes
Message 8 of 9

amitnkukanur
Collaborator
Collaborator

I got it myseld from the current state ID

Senior Software Engineer
0 Likes
Message 9 of 9

Anonymous
Not applicable

Hello, 

I have a similar problem the Post event it fires, but the Pre event dont fires, I only will know the last lyfecyclestate before the user has change it, for example the user makes a change from "A state to B state", in the Post event I know that the new state is the "B state"  but I will know the A state, the problem is that the Pre event dont fire.

 

  public void OnStartup(IApplication application)
        {
            m_explorerApplication = application;

            DocumentServiceExtensions.UpdateFileLifecycleStateEvents.Pre += new EventHandler<UpdateFileLifeCycleStateCommandEventArgs>(UpdateFileLifecycleStateEvents_Pre);


            DocumentServiceExtensions.UpdateFileLifecycleStateEvents.Post +=
             new EventHandler<UpdateFileLifeCycleStateCommandEventArgs>(UpdateFileLifecycleStateEvents_Post);

        
        }

 void UpdateFileLifecycleStateEvents_Post(object sender, UpdateFileLifeCycleStateCommandEventArgs e)
        {
//My logic, this event is fired and works.
}

void UpdateFileLifecycleStateEvents_Pre(object sender, UpdateFileLifeCycleStateCommandEventArgs e)
        {
            // this event is never fired. dont works....
        }

 Why I have this problem?

0 Likes