Functions to use in Queries, Filters

Joris on Dynamics AX Musings wrote this Blog Entry: Custom Query Range Functions using SysQueryRangeUtil

The following functions can be used in any query or filter. Note that the functions are case sensitive and need to be put in brackets e.g. (currentUserId()).

 

Current user (or roles thereof)

  • currentUserId()
  • currentEmployeeId()
  • currentBusinessRelationsAccount()
  • currentContactPersonId()
  • currentCustomerAccount()
  • currentVendorAccount()

Dates (all but dateRange are relate to the current date and time)

    • currentSessionDate()
    • currentSessionDateTime()

    • day(int relativeDays = 0)
    • dayRange(int relativeDaysFrom = 0, int relativeDaysTo = 0)
    • greaterThanDate(int relativeDays = 0)
    • lessThanDate(int relativeDays = 0)
    • monthRange(int relativeMonthsFrom = 0, int relativeMonthsTo = 0)
    • yearRange(int relativeYearsFrom = 0, int relativeYearsTo = 0)

  • dateRange(date startDate, date endDate)

Constants

  • currentStaticMasterPlan()

AX2012 only

    • currentDate()
    • currentLanguageId()
    • currentUserLanguage();
    • currentWorker()
    • currentWorkerRecId()
    • currentLegalEntity()
    • currentParty()
    • advancedLedgerEntryCurrentUserFilter(boolean _createdBy)
    • advancedLedgerEntryTxtOpenDraftAll(anytype _advancedLedgerEntryTransactionStatus)
    • currentRoleHasAccessToPrivate(boolean _useCache = true)
    • currentStaticMasterPlanVersion()
    • dateRange(date startDate, date endDate)

    • lessThanUtcDate(int relativeDays = 0)
    • lessThanUtcNow()

    • greaterThanUtcDate(int relativeDays = 0)
    • greaterThanUtcNow()

  • documentStatusPurchOrderOrGreater()
  • getActiveMasterPlanVersionByPlanId(ReqPlanId _planId)
  • isDirAddressPolicyOff()
  • isPrivate()
  • pmfInventTableIsBOM()
  • pmfInventTableIsBOMFormula()
  • projActiveAll(ProjActiveAll _projActiveAll)
  • projActiveAllWIPEliminated(anytype _ProjTableActiveAll)
  • projLevels(ProjLevels _projLevels)
  • projPostedTransType(ProjPostTransViewType _projPostedTransViewType)
  • projUnpostedTransType(ProjUnpostedTransViewType _projUnpostedTransViewType)
  • salesQuotationTemplateGroupFilter(SalesQuotationFilter _salesQuotationFilter)
  • salesQuotationTypeListPageFilter(SalesQuotationTypeListPage _salesQuotationTypeListPage)
  • sessionGuid()
  • workflowDelegationFilter(WorkflowDelegationView _filter)

As you see AX 2012 has many more predefined special ranges, many of which are not very self explanatory, as they are not really intended for general use, but are used in the filters of the pre-filtered list pages.

And remember: as Joris showed, you can easily extend the list.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s