Rules Set field value only if NOT empty

Home Forums Classic DFFS Rules Set field value only if NOT empty

Viewing 3 reply threads
  • Author
    Posts
    • #27427
      Brett
      Participant

        HI Alexander,

        I’m copying 3x field’s using a Rule:
        If field Status is changed to Approved, Set field value.
        1. Hours, 2. 1st Approver, 3. 2nd Approver.
        2. Req Hours, 2. Req 1st Approver, 3. Req 2nd Approver

        But I don’t want to blank the designated field if a Requested field has not been filled in.
        Is there a way to only copy the value if the field is NOT blank?

        My Edit Form is attached for more clarity.
        Thanks for your time.

      • #27430
        AdamP
        Participant

          I’m not quite sure I follow exactly what you’re doing, but there’s an option in the UI to only set the field value if the destination field isn’t empty. See screenshot.
          Does that help?

          Attachments:
        • #27451
          Alexander Bautz
          Keymaster

            Hi,
            Are you trying to only copy it if the SOURCE field is not empty? – if so you will have to use custom js. Try calling a function like this from your rule:

            function copyFieldValues() {
                var val = getFieldValue("YOUR_FROM_FIELD");
                if (val.length > 0) {
                    setFieldValue("YOUR_TO_FIELD", val);
                }
            }

            Repeat the code for the other fields inside the function.

            Alexander

          • #27459
            Brett
            Participant

              Thanks Alexander,
              It has worked perfectly.
              Much appreciated.
              $ for Support sent via PayPal.

          Viewing 3 reply threads
          • You must be logged in to reply to this topic.