Place tickmark in the Allow box.....
the question is in the API forum, so I guess the question is how to get the transition permission via API.
Yes that is what I want to do
I haven't had to do this for a while but my initial recollection is that you need to look at the "AccessControlList" property on the state transition API object: M-Files API - StateTransition Object
When working with the access control lists via the API note that the actual property names of the various elements are designed to mimic the access control list functionality on an object in the vault, but are re-used for things like this. As a result it may be easiest to have a specific ACL configured on a state transition first, then observe the state of the resulting COM API object to see what properties do what.
this is the code so far. Can't figure out from there
Have you checked what you get back there, and what the state of the objects are?
My assumption is that the state transition's AccessControlList has a "CustomComponent", and that CustomComponent has AccessControlEntries values for each entry in the above screenshot (e.g. for the one you showed, one entry that represents the pseudo-user entry).
Is that correct so far? Or not? What are you seeing when you debug this code and look at the state of things?
When I try to pull access entries I get an interface error
Example that for each loop gives an error. So how is it supposed to be
Can you give the full error, and show the code that produces it?
In your code sample you are calling a method (developer.m-files.com/.../ that returns StateTransitionsForClient. You can't cast those items to a StateTransition.
I think you will need to use GetWorkflowAdmin to retrieve the workflow then get the state transitions from there.
In your code sample you are calling a method (developer.m-files.com/.../ that returns StateTransitionsForClient. You can't cast those items to a StateTransition.
I think you will need to use GetWorkflowAdmin to retrieve the workflow then get the state transitions from there.
I have pulled workflow and states just as you have specified and also I have managed to loop through states. What is the next method to call?
If you have the state transition (you said state - do you mean the transition?) then you should be able to place a breakpoint and take a look at the state transition object at that moment.
Then, looking at the original guidance, does that give you a starting point?
I have managed to figure it out and actually it works. so this is how it is supposed to work.
var workflow = vault.WorkflowOperations.GetWorkflowAdmin(107);
foreach(StateTransition stateTransition in workflow.StateTransitions)
{
if(stateTransition.FromState==137&&stateTransition.ToState==138)
{
AccessControlList acl = stateTransition.AccessControlList; // Display the ACL details
foreach (AccessControlEntry accessControlEntry1 in acl)
{
if (accessControlEntry1.IsGroup)
{
var usergroup = vault.UserGroupOperations.GetUserGroup(accessControlEntry1.UserOrGroupID);
foreach(var account in usergroup.Members)
{
var userid = vault.UserOperations.GetLoginAccountOfUser(Convert.ToInt16(account));
if (userid.EmailAddress == useremail)
{
Console.WriteLine("Can transition");
break;
}
}
}
else
{
Console.WriteLine(accessControlEntry1.UserOrGroupID);
}
}
}
}
© 2024 M-Files, All Rights Reserved.