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

Change State (Admin) in VAF/VB

Hello,

Is there a way to add in an Event Handler script (VB or VAF) a change state admin? 

Or how can i transition an object in a state, that is not directly linked in workflow to the current state?

When the trigger is met now, if i am logged with admin account, the transition works as expected and if I am logged with a normal user, i get an access denied error.

Here is my sample code:

var objVerChanges = new ObjVerChanges(env.ObjVerEx);


if (objVerChanges.HasChanged(pd.GetPropertyDefIDByAlias("M-Files.ComplianceKit.FileVersion")))
{

	env.ObjVerEx.SetWorkflowState(103, 116);
	env.ObjVerEx.SaveProperties();

}

DocumentCache.cpp, 7143, Access denied. (0x800407E4)
DocumentCache.cpp, 18571, Access denied. (0x800407E4)
RPCMethodCallWithRetry.h, 27, Access denied. (0x800407E4)
RPCMethodCallWithRetry.h, 27, Access denied. (0x800407E4)
RPCDocumentOperations.cpp, 11555, Access denied. (0x800407E4)
RPCDocumentOperations.cpp, 5807, Access denied. (0x800407E4)
MCallInLoop.h, 712, Access denied. (0x800407E4)
RPCDocumentOperationsHelper.cpp, 1910, Access denied. (0x800407E4)
RPCDocumentOperationsHelperPrivate.cpp, 205, Access denied. (0x800407E4)
RPCDocumentOperationsHelper.cpp, 8946, Access denied. (0x800407E4)
RPCDocumentOperationsHelper.cpp, 9525, Access denied. (0x800407E4)
RPCDocumentOperationsHelper.cpp, 26988, Access denied. (0x800407E4)
RPCDocumentOperationsHelperPrivate.cpp, 2812, Access denied. (0x800407E4)
StateTransitionManager.cpp, 678, Access denied. (0x800407E4)
RPCDocumentOperationsHelper.cpp, 23282, Access denied. (0x800407E4)
RPCDocumentOperationsHelper.cpp, 23282, The state transition "Aprobat -> In lucru" is not allowed. (0x800400C3)
(M-Files 21.3.10021.4)
Regards,
Radu
  • Hi Radu,

    If I understand correctly you want to move document into workflow state automatically and this can be done only by Admin? It is also not a direct next state (no transition existing to that state). On change you would move it to that state.

    Don't know if this matches your requirement but here is a suggestion: we have used auto state transition to move document to specific state when some condition matches (in our case responsible persons changed for linked object and we needed to re-assigned the document automatically). Auto state transitions run periodically, per default every hour (you can configure it in registry). This happens on server side so you don't need to re-logging with admin. You would though need existing transition between workflow states.

    Is your action dependent on Admin or can be done automatically?

    Br, Dejan

  • Hello Dejan,

    After I added a direct link between them, it worked.

    But I did not want a direct link between the States, and I need the transition to happen as soon as a document is modified after it has been approved, because it will require a new approval.