Hi guys,

Certified Associate Developer

I am  trying to do some validations using two fields scheduled date and assignee.

Sheduled date should be mandatory field if the user add any name in assignee field.

If there is no name in assignee field the system should allow to continue without scheduled date.

  Discussion posts and replies are publicly visible

Parents
  • Adding some sample code illustrating Stewart and Richard's notes, which I agree with:

    a!localVariables(
      local!date,
      local!assignee,
    
      a!formLayout(
        label: "Conditional Required Fields",
        contents: {
          a!columnsLayout(
            columns: {
              a!columnLayout(),
              a!columnLayout(
                contents: {
                  a!sideBySideLayout(
                    items: {
                      a!sideBySideItem(
                        item: a!dateField(
                          label: "Date",
                          value: local!date,
                          saveInto: local!date,
                          required: not(rule!APN_isEmpty(local!assignee))
                        )
                      ),
                      a!sideBySideItem(
                        item: a!pickerFieldUsers(
                          label: "Assignee",
                          value: local!assignee,
                          saveInto: local!assignee
                        )
                      )
                    }
                  )
                }
              ),
              a!columnLayout()
            }
          )
        },
        buttons: a!buttonLayout(
          primaryButtons: {
            a!buttonWidget(
              label: "Submit",
              validate: true,
              submit: true
            )
          }
        )
      )
    )

Reply
  • Adding some sample code illustrating Stewart and Richard's notes, which I agree with:

    a!localVariables(
      local!date,
      local!assignee,
    
      a!formLayout(
        label: "Conditional Required Fields",
        contents: {
          a!columnsLayout(
            columns: {
              a!columnLayout(),
              a!columnLayout(
                contents: {
                  a!sideBySideLayout(
                    items: {
                      a!sideBySideItem(
                        item: a!dateField(
                          label: "Date",
                          value: local!date,
                          saveInto: local!date,
                          required: not(rule!APN_isEmpty(local!assignee))
                        )
                      ),
                      a!sideBySideItem(
                        item: a!pickerFieldUsers(
                          label: "Assignee",
                          value: local!assignee,
                          saveInto: local!assignee
                        )
                      )
                    }
                  )
                }
              ),
              a!columnLayout()
            }
          )
        },
        buttons: a!buttonLayout(
          primaryButtons: {
            a!buttonWidget(
              label: "Submit",
              validate: true,
              submit: true
            )
          }
        )
      )
    )

Children
No Data