0

如果调用者是 EP 或客户端,我需要检查 X++,因此如果调用者是该代码中的 EP,我可以进行一些自定义。请让我知道这怎么可能

注意:我对 EP 和 AX 客户端都使用 ListPageInteraction 类,如果调用者是 ListPageInteraction 类中的 EP,我必须对相同的查询(用于两者)进行一些修改

4

1 回答 1

0

检查 NumberSeqNumCache.isEpClient 方法,它看起来像这样:

/// <summary>
///    Determines whether the request is from EP.
/// </summary>
/// <returns>
///    true if EP is the caller; otherwise, false.
/// </returns>
static server boolean isEpClient()
{
     xSession session = new xsession();
     boolean isEP = false;
     sysClientSessions clientsessions;
     ;


    select ClientType from clientsessions where clientsessions.SessionId == session.sessionId();

    if (clientSessions.ClientType == SessionType::WebUser || clientsessions.clientType == SessionType::Worker)
    {
         isEp = true;
    }

    return isEp;
}

它检查当前会话的类型是 webuser 还是 worker。如果您使用客户端,会话将是 SessionType::GUI 类型。请注意,其他会话也可能注册为 SessionType::Worker 类型,例如批处理任务,因此这可能不适用于任何地方。

于 2014-02-13T12:06:18.807 回答