cannot fill input to the form

Certified Senior Developer

Expression evaluation error [evaluation ID = ] in rule 'pa_addvehicle' at function 'todate' parameter 1 [line 75]: PA Vehicle can only be indexed into using square brackets or the index function

  Discussion posts and replies are publicly visible

  • +1
    Certified Associate Developer
    in reply to shrutij9485

    Since ri!vehicle is a record type, you can't refer to it like this:

    ri!vehicle.vehicleLastMaintenanceDate

    This is the way we are referring to CDT fields.

    The proper way to refer to a record type field is:

    ri!vehicle[recordType!Vehicle.fields.vehicleLastMaintenanceDate]

    Here is the part of the code that is giving you the error (fixed):

     

    a!dateField(
        label: "Last Maintenance",
        labelPosition: "ABOVE",
        value: ri!vehicle['recordType!{daaebabb-0af7-4cd6-b5ae-12bff43fe006}.fields.{3eaef3a8-ad19-4e10-bbf4-b07b6944ab3e}'],
        saveInto: ri!vehicle['recordType!{daaebabb-0af7-4cd6-b5ae-12bff43fe006}.fields.{3eaef3a8-ad19-4e10-bbf4-b07b6944ab3e}'],
        required: false,
        validations: if(
          todate(ri!vehicle['recordType!{daaebabb-0af7-4cd6-b5ae-12bff43fe006}.fields.{f3c174c0-2185-4448-95c2-0b66847d3de5}']) < 
          todate(ri!vehicle['recordType!{daaebabb-0af7-4cd6-b5ae-12bff43fe006}.fields.{3eaef3a8-ad19-4e10-bbf4-b07b6944ab3e}']),
          "The next maintenance date must be after the last maintenance date.",
          null
        )
      )

    I saw that you have done the same mistake again in your code so you have to fix it also.