Developer Programs

Learn

Docs

ActUsrDsp

API Reference > ActUsrDsp
SoapActionn/a
Input NameActUsrDsp
Output NameActUsrDspResponse
Input Namespacen/a
Group NameXperience
ContainerXP_MsgBus.xsd
ActUsrDsp.cs
// This will activate a display to the user much like the Operator
// Override that will allow the user to select another user that is
// currently active in the current instance.  Users can optionally be
// filtered based on one or more roles (as defined in Active Directory)
// and/or one or more alias claims. Information about the selected user
// will be returned to the calling application.
ActUsrDspRq_MType msg = new ActUsrDspRq_MType()
{
    HdrText = "Available Users",
    Prompt = "Select an active user:",
    AcptText = "Use Selected User",
    AliasArray = new AliasRec_CType[1]
    {
        new AliasRec_CType()
        {
            Alias = "TestAliasRecord",
            AliasContext = "TestAliasContext"
        }
    },
    RoleArray = new Role_CType[1]
    {
        new Role_CType() { RoleName = "TestManagerRole" }
    }
};

// NOTE:  The actual Regex expression used is the responsibility of the calling client.
// The Xperience framework will simply take the supplied string and return items that
// have a "Success" return from a Regex.Match() on the item being filtered.  The examples
// below show using (?i) to ignore casing and using Regex.Escape() to assure that the
// regular expression string being passed meets standards, but these are not required.
private void ButtonSelectActiveUsers_Click(object sender, RoutedEventArgs e)
{
    var hostedWindow = XperienceContext.Current.WindowManager.GetByContentInstance(this);

    if (hostedWindow != null)
    {
        ActUsrDspRq_MType request = new ActUsrDspRq_MType()
        {
            HostId = hostedWindow.WindowId,
            RegExSrch = new RegExSrch_CType()
            {
                RegExFilterArray = new RegExFilter_CType[]
                {
                    new RegExFilter_CType()
                    {
                        // The first operand is ignored per EA contract, BUT is required:
                        RegExOperand = "OR",
                        RegExElemName = "Alias",
                        RegExCond = string.Format(@"(?i){0}", Regex.Escape(@"tgallup")),
                        RegExSeqFilter = new RegExInfo_CType()
                        {
                            RegExOperand = "AND",
                            RegExElemName = "AliasContext",
                            RegExCond = string.Format(@"(?i){0}",
                                Regex.Escape(@"TestContext1")),
                            RegExSeqFilter = new RegExInfo_CType()
                            {
                                RegExOperand = "AND",
                                RegExElemName = "AliasAppliesToApp",
                                RegExCond = string.Format(@"(?i){0}",
                                    Regex.Escape(@"http://jackhenry.com/application/Core")),
                                RegExSeqFilter = null
                            }
                        }
                    },
                    new RegExFilter_CType()
                    {
                        RegExOperand = "OR",
                        RegExElemName = "Role",
                        RegExCond = string.Format(@"(?i){0}", "BranchManager*"),
                        RegExSeqFilter = null
                    }
                }
            }
        };

        MessageHelper.FillHeader(request);

        this.messageBus
            .Send(request)
            .RegisterResponseHandler(this.OnActiveUsersResponse);
    }
}

private void OnActiveUsersResponse(IMessageContext context)
{
    if (!context.IsValid())
    {
        string errors = MessageHelper.CollectionErrors(context.Errors);
        this.DisplayOutput("Response Errors:  " + errors);
        return;
    }

    ActUsrDspRs_MType response = context.DeserializeMessage();

    if (response.RsStat == ResponseStatus.Fail.ToString())
    {
        this.DisplayOutput("Operator Override was Cancelled");
    }
    else
    {
        string selectedUsers = string.Empty;

        foreach (var user in response.UsrPrincNameArray)
        {
            selectedUsers += user.UsrPrincName.Value;
            selectedUsers += ", ";
        }

        this.DisplayOutput("Selected User(s): " + selectedUsers);
    }
}

Did this page help you?

Last updated Mon Dec 9 2024