Validation rule - created date < FIXED DATE





.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty{ margin-bottom:0;
}






up vote
2
down vote

favorite












I'm trying to add a line to a set of existing validation rules so they only apply to opportunities created prior to a fixed date. Let's say 10/31/2018. I thought it would be pretty straightforward as



CreatedDate < 10/31/2018



So the entire rule would read:



ISPICKVAL ( StageName, "Demo")&&



Clinical_Buyer__c = FALSE&&



CreatedDate < 10/31/2018



I keep getting the error that the '<' was expecting a DateTime received Number.










share|improve this question




























    up vote
    2
    down vote

    favorite












    I'm trying to add a line to a set of existing validation rules so they only apply to opportunities created prior to a fixed date. Let's say 10/31/2018. I thought it would be pretty straightforward as



    CreatedDate < 10/31/2018



    So the entire rule would read:



    ISPICKVAL ( StageName, "Demo")&&



    Clinical_Buyer__c = FALSE&&



    CreatedDate < 10/31/2018



    I keep getting the error that the '<' was expecting a DateTime received Number.










    share|improve this question
























      up vote
      2
      down vote

      favorite









      up vote
      2
      down vote

      favorite











      I'm trying to add a line to a set of existing validation rules so they only apply to opportunities created prior to a fixed date. Let's say 10/31/2018. I thought it would be pretty straightforward as



      CreatedDate < 10/31/2018



      So the entire rule would read:



      ISPICKVAL ( StageName, "Demo")&&



      Clinical_Buyer__c = FALSE&&



      CreatedDate < 10/31/2018



      I keep getting the error that the '<' was expecting a DateTime received Number.










      share|improve this question













      I'm trying to add a line to a set of existing validation rules so they only apply to opportunities created prior to a fixed date. Let's say 10/31/2018. I thought it would be pretty straightforward as



      CreatedDate < 10/31/2018



      So the entire rule would read:



      ISPICKVAL ( StageName, "Demo")&&



      Clinical_Buyer__c = FALSE&&



      CreatedDate < 10/31/2018



      I keep getting the error that the '<' was expecting a DateTime received Number.







      formula validation validation-rule






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked 2 days ago









      Devin Pearman

      227




      227






















          1 Answer
          1






          active

          oldest

          votes

















          up vote
          6
          down vote



          accepted










          Unlike SOQL, formulas don't accept date literals. You'll need to construct your Date values using either the DATE() function :




          The DATE() function returns a Date value, given a year, month, and day. Numerical Y/M/D values and the YEAR(), MONTH(), and DAY() functions are valid parameters for DATE(). For example DATE( 2013, 6, 1 ) returns June 1, 2013




          or the DATEVALUE() function, with a text parameter in ISO format:




          You can also convert text to a Date so you can use the string value with your other Date fields and formulas. You’ll want your text to be formatted as “YYYY-MM-DD”. Use this formula to return the Date value:



          DATEVALUE( "YYYY-MM-DD" )




          If you want to compare the DateTime CreatedDate to a Date value, you can convert the field value with DATEVALUE():



          DATEVALUE(CreatedDate) < DATEVALUE("2018-10-31") 





          share|improve this answer























          • I've attempted to use the DATE() function, but still getting an error: Incorrect parameter type for operator '<'. Expected DateTime, received Date I had entered: CreatedDate < DATE(2018,10,1)
            – Devin Pearman
            2 days ago












          • You can convert the DateTime to a Date with the DATEVALUE() function, too.
            – David Reed
            2 days ago










          • I'm not 100% on what you're meaning by converting to a DateTime, when this is all in a validation rule, there's got to be something I'm not understanding. I've tried adding a DATEVALUE but that doesn't seem to work either, perhaps I'm not using the correct syntax: ISPICKVAL ( StageName, "Negotiation")&& Clinical_Acceptance__c = FALSE&& CreatedDate < DATEVALUE("2018-10-31") The error I'm receiving: "Error: Incorrect parameter type for operator '<'. Expected DateTime, received Date"
            – Devin Pearman
            2 days ago












          • thank you so much, this worked perfectly!
            – Devin Pearman
            yesterday











          Your Answer








          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "459"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          convertImagesToLinks: false,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: null,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














           

          draft saved


          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsalesforce.stackexchange.com%2fquestions%2f239896%2fvalidation-rule-created-date-fixed-date%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes








          up vote
          6
          down vote



          accepted










          Unlike SOQL, formulas don't accept date literals. You'll need to construct your Date values using either the DATE() function :




          The DATE() function returns a Date value, given a year, month, and day. Numerical Y/M/D values and the YEAR(), MONTH(), and DAY() functions are valid parameters for DATE(). For example DATE( 2013, 6, 1 ) returns June 1, 2013




          or the DATEVALUE() function, with a text parameter in ISO format:




          You can also convert text to a Date so you can use the string value with your other Date fields and formulas. You’ll want your text to be formatted as “YYYY-MM-DD”. Use this formula to return the Date value:



          DATEVALUE( "YYYY-MM-DD" )




          If you want to compare the DateTime CreatedDate to a Date value, you can convert the field value with DATEVALUE():



          DATEVALUE(CreatedDate) < DATEVALUE("2018-10-31") 





          share|improve this answer























          • I've attempted to use the DATE() function, but still getting an error: Incorrect parameter type for operator '<'. Expected DateTime, received Date I had entered: CreatedDate < DATE(2018,10,1)
            – Devin Pearman
            2 days ago












          • You can convert the DateTime to a Date with the DATEVALUE() function, too.
            – David Reed
            2 days ago










          • I'm not 100% on what you're meaning by converting to a DateTime, when this is all in a validation rule, there's got to be something I'm not understanding. I've tried adding a DATEVALUE but that doesn't seem to work either, perhaps I'm not using the correct syntax: ISPICKVAL ( StageName, "Negotiation")&& Clinical_Acceptance__c = FALSE&& CreatedDate < DATEVALUE("2018-10-31") The error I'm receiving: "Error: Incorrect parameter type for operator '<'. Expected DateTime, received Date"
            – Devin Pearman
            2 days ago












          • thank you so much, this worked perfectly!
            – Devin Pearman
            yesterday















          up vote
          6
          down vote



          accepted










          Unlike SOQL, formulas don't accept date literals. You'll need to construct your Date values using either the DATE() function :




          The DATE() function returns a Date value, given a year, month, and day. Numerical Y/M/D values and the YEAR(), MONTH(), and DAY() functions are valid parameters for DATE(). For example DATE( 2013, 6, 1 ) returns June 1, 2013




          or the DATEVALUE() function, with a text parameter in ISO format:




          You can also convert text to a Date so you can use the string value with your other Date fields and formulas. You’ll want your text to be formatted as “YYYY-MM-DD”. Use this formula to return the Date value:



          DATEVALUE( "YYYY-MM-DD" )




          If you want to compare the DateTime CreatedDate to a Date value, you can convert the field value with DATEVALUE():



          DATEVALUE(CreatedDate) < DATEVALUE("2018-10-31") 





          share|improve this answer























          • I've attempted to use the DATE() function, but still getting an error: Incorrect parameter type for operator '<'. Expected DateTime, received Date I had entered: CreatedDate < DATE(2018,10,1)
            – Devin Pearman
            2 days ago












          • You can convert the DateTime to a Date with the DATEVALUE() function, too.
            – David Reed
            2 days ago










          • I'm not 100% on what you're meaning by converting to a DateTime, when this is all in a validation rule, there's got to be something I'm not understanding. I've tried adding a DATEVALUE but that doesn't seem to work either, perhaps I'm not using the correct syntax: ISPICKVAL ( StageName, "Negotiation")&& Clinical_Acceptance__c = FALSE&& CreatedDate < DATEVALUE("2018-10-31") The error I'm receiving: "Error: Incorrect parameter type for operator '<'. Expected DateTime, received Date"
            – Devin Pearman
            2 days ago












          • thank you so much, this worked perfectly!
            – Devin Pearman
            yesterday













          up vote
          6
          down vote



          accepted







          up vote
          6
          down vote



          accepted






          Unlike SOQL, formulas don't accept date literals. You'll need to construct your Date values using either the DATE() function :




          The DATE() function returns a Date value, given a year, month, and day. Numerical Y/M/D values and the YEAR(), MONTH(), and DAY() functions are valid parameters for DATE(). For example DATE( 2013, 6, 1 ) returns June 1, 2013




          or the DATEVALUE() function, with a text parameter in ISO format:




          You can also convert text to a Date so you can use the string value with your other Date fields and formulas. You’ll want your text to be formatted as “YYYY-MM-DD”. Use this formula to return the Date value:



          DATEVALUE( "YYYY-MM-DD" )




          If you want to compare the DateTime CreatedDate to a Date value, you can convert the field value with DATEVALUE():



          DATEVALUE(CreatedDate) < DATEVALUE("2018-10-31") 





          share|improve this answer














          Unlike SOQL, formulas don't accept date literals. You'll need to construct your Date values using either the DATE() function :




          The DATE() function returns a Date value, given a year, month, and day. Numerical Y/M/D values and the YEAR(), MONTH(), and DAY() functions are valid parameters for DATE(). For example DATE( 2013, 6, 1 ) returns June 1, 2013




          or the DATEVALUE() function, with a text parameter in ISO format:




          You can also convert text to a Date so you can use the string value with your other Date fields and formulas. You’ll want your text to be formatted as “YYYY-MM-DD”. Use this formula to return the Date value:



          DATEVALUE( "YYYY-MM-DD" )




          If you want to compare the DateTime CreatedDate to a Date value, you can convert the field value with DATEVALUE():



          DATEVALUE(CreatedDate) < DATEVALUE("2018-10-31") 






          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited 2 days ago

























          answered 2 days ago









          David Reed

          25.9k51644




          25.9k51644












          • I've attempted to use the DATE() function, but still getting an error: Incorrect parameter type for operator '<'. Expected DateTime, received Date I had entered: CreatedDate < DATE(2018,10,1)
            – Devin Pearman
            2 days ago












          • You can convert the DateTime to a Date with the DATEVALUE() function, too.
            – David Reed
            2 days ago










          • I'm not 100% on what you're meaning by converting to a DateTime, when this is all in a validation rule, there's got to be something I'm not understanding. I've tried adding a DATEVALUE but that doesn't seem to work either, perhaps I'm not using the correct syntax: ISPICKVAL ( StageName, "Negotiation")&& Clinical_Acceptance__c = FALSE&& CreatedDate < DATEVALUE("2018-10-31") The error I'm receiving: "Error: Incorrect parameter type for operator '<'. Expected DateTime, received Date"
            – Devin Pearman
            2 days ago












          • thank you so much, this worked perfectly!
            – Devin Pearman
            yesterday


















          • I've attempted to use the DATE() function, but still getting an error: Incorrect parameter type for operator '<'. Expected DateTime, received Date I had entered: CreatedDate < DATE(2018,10,1)
            – Devin Pearman
            2 days ago












          • You can convert the DateTime to a Date with the DATEVALUE() function, too.
            – David Reed
            2 days ago










          • I'm not 100% on what you're meaning by converting to a DateTime, when this is all in a validation rule, there's got to be something I'm not understanding. I've tried adding a DATEVALUE but that doesn't seem to work either, perhaps I'm not using the correct syntax: ISPICKVAL ( StageName, "Negotiation")&& Clinical_Acceptance__c = FALSE&& CreatedDate < DATEVALUE("2018-10-31") The error I'm receiving: "Error: Incorrect parameter type for operator '<'. Expected DateTime, received Date"
            – Devin Pearman
            2 days ago












          • thank you so much, this worked perfectly!
            – Devin Pearman
            yesterday
















          I've attempted to use the DATE() function, but still getting an error: Incorrect parameter type for operator '<'. Expected DateTime, received Date I had entered: CreatedDate < DATE(2018,10,1)
          – Devin Pearman
          2 days ago






          I've attempted to use the DATE() function, but still getting an error: Incorrect parameter type for operator '<'. Expected DateTime, received Date I had entered: CreatedDate < DATE(2018,10,1)
          – Devin Pearman
          2 days ago














          You can convert the DateTime to a Date with the DATEVALUE() function, too.
          – David Reed
          2 days ago




          You can convert the DateTime to a Date with the DATEVALUE() function, too.
          – David Reed
          2 days ago












          I'm not 100% on what you're meaning by converting to a DateTime, when this is all in a validation rule, there's got to be something I'm not understanding. I've tried adding a DATEVALUE but that doesn't seem to work either, perhaps I'm not using the correct syntax: ISPICKVAL ( StageName, "Negotiation")&& Clinical_Acceptance__c = FALSE&& CreatedDate < DATEVALUE("2018-10-31") The error I'm receiving: "Error: Incorrect parameter type for operator '<'. Expected DateTime, received Date"
          – Devin Pearman
          2 days ago






          I'm not 100% on what you're meaning by converting to a DateTime, when this is all in a validation rule, there's got to be something I'm not understanding. I've tried adding a DATEVALUE but that doesn't seem to work either, perhaps I'm not using the correct syntax: ISPICKVAL ( StageName, "Negotiation")&& Clinical_Acceptance__c = FALSE&& CreatedDate < DATEVALUE("2018-10-31") The error I'm receiving: "Error: Incorrect parameter type for operator '<'. Expected DateTime, received Date"
          – Devin Pearman
          2 days ago














          thank you so much, this worked perfectly!
          – Devin Pearman
          yesterday




          thank you so much, this worked perfectly!
          – Devin Pearman
          yesterday


















           

          draft saved


          draft discarded



















































           


          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsalesforce.stackexchange.com%2fquestions%2f239896%2fvalidation-rule-created-date-fixed-date%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          サソリ

          広島県道265号伴広島線

          Accessing regular linux commands in Huawei's Dopra Linux