Skip to main content
February 8, 2023
Question

Interface Definition: Expression evaluation error at function 'calworkdays' [line 83]: A null parameter has been passed as parameter 1.

  • February 8, 2023
  • 7 replies
  • 0 views

a!dateField(
label: "Return To Office Date",
labelPosition: if(ri!readOnly, "ADJACENT", "ABOVE"),
value: ri!NIC_LeaveSummary.returntoofficedate,
saveInto: ri!NIC_LeaveSummary.returntoofficedate,
readOnly: ri!isLeaveApplied,
validations: {
if(calworkdays(ri!NIC_LeaveSummary.leavestartdate,ri!NIC_LeaveSummary.returntoofficedate)- 1 >5,"You can apply max 5 days leaves",{}),
if(
a!isNotNullOrEmpty(ri!NIC_LeaveSummary.leavestartdate),
if(
calisworkday(ri!NIC_LeaveSummary.leavestartdate),
{},
"Please select weekdays. Weekends are not allowed"
),
{}
),
if(
a!isNullOrEmpty(ri!NIC_LeaveSummary.leavestartdate),
"Please select leave start date",
{}
),
if(
ri!NIC_LeaveSummary.leavestartdate > ri!NIC_LeaveSummary.returntoofficedate,
" Please select return to office date later than leave start date",
{}
),
}
),

    7 replies

    stefanhelzle0001
    Brainy
    February 8, 2023

    The error message is very clear. Do you have a specific question?

    konduruc733182
    February 8, 2023

    Hello kajalp8940,

    Is this error when you have not yet interacted with the fields?

    If yes then it is because you are passing null values to evaluate the calworkdays function. You will have to do a null check and then do the validations. You will have to write a condition in such a way that if the values are empty, it does not validate. only when your values that are being evaluated are not null the validation ,ust be done.

    abhayd3663
    February 11, 2023

    It is a good practice to use index() instead of dot notation and do the null checks.

    vipulk0003
    September 1, 2023

    if(or(a!isNullOrEmpty(ri!NIC_LeaveSummary.leavestartdate),a!isNullOrEmpty(ri!NIC_LeaveSummary.returntoofficedate)),{},if( calworkdays(ri!NIC_LeaveSummary.leavestartdate,ri!NIC_LeaveSummary.returntoofficedate) -1 > 5,"You can apply max 5 days leave",{})),

    anmolv0003
    Participating Frequently
    September 1, 2023

    Anmol
    vipulk0003
    September 1, 2023

    if(or(a!isNullOrEmpty(ri!NIC_LeaveSummary.leavestartdate),a!isNullOrEmpty(ri!NIC_LeaveSummary.returntoofficedate)),{},
    if( calworkdays(ri!NIC_LeaveSummary.leavestartdate,ri!NIC_LeaveSummary.returntoofficedate) -1 > 5,
    "You can apply max 5 days leave",{})),