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

How to add a visible to current user search condition when searching for value list items?

Hi!

Using VAF, is there a way to add a visible to current user search condition when searching for value list items? I know it's possible to add that condition when executing a normal search and I have used it successfully before like this:

var sc = new SearchCondition();

sc.Expression.SetPermissionExpression(MFPermissionsExpressionType.MFVisibleTo);
sc.ConditionType = MFConditionType.MFConditionTypeEqual;
sc.TypedValue.SetValue(MFDataType.MFDatatypeLookup, env.CurrentUserID);

However I can't find a way to do a similar thing when searching for value list items using this:

env.Vault.ValueListItemOperations.SearchForValueListItems

Is it even possible and if not, are there any workarounds?

Kind regards

Jussi

Parents
  • We are sending some initial data from VAF to UIX and that data is mainly gathered by normal searches, but there are some values that only exist as value lists. However the client has apparently made some restrictions and all value list items are not visible to all users. So in order to only show the allowed values I'd need to somehow include the user id in the value list search.

    And yeah I know this is not exactly the proper way to even use VAF, as I could fetch that initial data from UIX. I just very much prefer coding in C# with all the nice helpers etc. compared to a "bit" dated JScript.

  • I wouldn't say that this is the wrong way at all.  As you said: writing UIX code is a pain sometimes.

    There is one additional thing I'd highlight: vault extension methods can be told to run "as" the calling user:

    [VaultExtensionMethod("MyVaultExtensionMethod",
        RequiredVaultAccess = MFVaultAccess.MFVaultAccessNone,
        // The vault user identity says that the vault should
        // be connected as the current user, not the server account.
        VaultUserIdentity = EventHandlerVaultUserIdentity.User)]
    private string MyVaultExtensionMethod(EventHandlerEnvironment env)
    {
        throw new System.NotImplementedException();
    }

    I haven't tried this with the exact search you're looking at, but that'd be my first approach.

  • Hi!

    Sorry for the late reply, but I just got a confirmation from the client that this indeed seems to solve the problem. With this approach we also no longer have to manually add that VisibleTo-condition to normal searches.

    Thanks for the help!

Reply Children
No Data