locked
FetchXML and JavaScript month RRS feed

  • Question

  • I have the following that runs a FetchXML query against the date today :

    var date = new Date();
    var today = date .format("yyyy-M-dd");
    fetchXml += "<condition attribute='new_date' operator='on' value= '" + today + "' />";

    I want to convert this so it gives me the result of the month. How do I do this?

    Monday, March 9, 2015 2:54 PM

All replies

  • Hey-

    Think you can accomplish this by using two conditions 1) on and after (first day this month; use JS to calculate this) 2) on and before (last day this month; use JS to calculate this)

    Make enough sense?


    If this post answers your question, please click "Mark As Answer" on the post and/or "Mark as Helpful"

    Monday, March 9, 2015 3:39 PM
  • I was under the impression that you could use the following condition:

    <condition attribute="createdon" operator="this-month" />

    Does this not work in FetchXML?


    Operator CRM Advanced Find Term
    lt Less Than
    gt Greater Than
    le Less Than or Equal To
    ge Greater Than or Equal To
    eq Equals
    ne Not Equals
    neq Not Equal To
    null Does Not Contain Data
    not-null Contains Data
    in Is In
    not-in Is Not In
    between Between
    not-between Is Not Between
    like Like
    not-like Not Like
    yesterday Yesterday
    today Today
    tomorrow Tomorrow
    next-seven-days Next Seven Days
    last-seven-days Last Seven Days
    next-week Next Week
    last-week Last Week
    this-month This Month
    last-month Last Month
    next-month Next Month
    on On
    on-or-before On or Before
    on-or-after On on After
    this-year This Year
    last-year Last Year
    next-year Next Year
    eq-userid Equals Current User
    ne-userid Does Not Equal Current User
    eq-businessid Equals Current Business Unit
    ne-businessid Does Not Equal Current Business Unit
    this-week This Week
    last-x-months Last X Months
    eq-userlanguage Equals User Language
    eq-userteams Equals Current User’s Teams
    in-fiscal-year In Fiscal Year
    in-fiscal-period In Fiscal Period
    in-fiscal-period-and-year In Fiscal Period and Year
    in-or-after-fiscal-period-and-year In or After Fiscal Period and Year
    in-or-before-fiscal-period-and-year In or Before Fiscal Period and Year
    last-fiscal-year Last Fiscal Year
    this-fiscal-year This Fiscal Year
    next-fiscal-year Next Fiscal Year
    last-x-fiscal-years Last X Fiscal Years
    next-x-fiscal-years Next X Fiscal Years
    last-fiscal-period Last Fiscal Period
    this-fiscal-period This Fiscal Period
    next-fiscal-period Next Fiscal Period
    last-x-fiscal-periods Last X Fiscal Periods
    next-x-fiscal-periods Next X Fiscal Periods
    • Edited by lemonje Monday, March 9, 2015 6:13 PM
    • Proposed as answer by Brett Rojas Monday, March 9, 2015 6:46 PM
    Monday, March 9, 2015 6:10 PM
  • oh duh, yeah sorry that is correct

    If this post answers your question, please click "Mark As Answer" on the post and/or "Mark as Helpful"

    Monday, March 9, 2015 6:46 PM