Hi Team,
I have an interface which contains the below code:
a!localVariables( local!category: rule!AA_QR_REF_getVehicleCategory, local!condition: rule!AA_QR_REF_getVehicleCategory, a!formLayout( label: "Add Vehicle", contents: { a!columnsLayout( columns: { a!columnLayout( contents: { a!sideBySideLayout( items: { a!sideBySideItem( item: a!integerField( label: "Year", labelPosition: "ABOVE", value: ri!vehicle['recordType!{2d40d6b6-da24-42b0-bb32-60ee92680827}AX Vehicle.fields.{a95bdbca-5309-4185-8722-94887416cf9e}vehicleYear'], saveInto: ri!vehicle['recordType!{2d40d6b6-da24-42b0-bb32-60ee92680827}AX Vehicle.fields.{a95bdbca-5309-4185-8722-94887416cf9e}vehicleYear'], required: false ) ), a!sideBySideItem( item: a!textField( label: "Make", labelPosition: "ABOVE", value: ri!vehicle['recordType!{2d40d6b6-da24-42b0-bb32-60ee92680827}AX Vehicle.fields.{f3ee4043-31b1-4162-8e1b-b77150e328db}vehicleMake'], saveInto: ri!vehicle['recordType!{2d40d6b6-da24-42b0-bb32-60ee92680827}AX Vehicle.fields.{f3ee4043-31b1-4162-8e1b-b77150e328db}vehicleMake'], characterLimit: 55, required: false ) ), a!sideBySideItem( item: a!textField( label: "Model", labelPosition: "ABOVE", value: ri!vehicle['recordType!{2d40d6b6-da24-42b0-bb32-60ee92680827}AX Vehicle.fields.{91915d5a-b55d-435a-b582-a2253c41f06d}vehicleModel'], saveInto: ri!vehicle['recordType!{2d40d6b6-da24-42b0-bb32-60ee92680827}AX Vehicle.fields.{91915d5a-b55d-435a-b582-a2253c41f06d}vehicleModel'], characterLimit: 55, required: false ) ) } ), a!textField( label: "Color", labelPosition: "ABOVE", value: ri!vehicle['recordType!{2d40d6b6-da24-42b0-bb32-60ee92680827}AX Vehicle.fields.{43cdb801-45d0-4f9a-ad23-aa004ca2cf5f}vehicleColor'], saveInto: ri!vehicle['recordType!{2d40d6b6-da24-42b0-bb32-60ee92680827}AX Vehicle.fields.{43cdb801-45d0-4f9a-ad23-aa004ca2cf5f}vehicleColor'], characterLimit: 55, required: false ), a!integerField( label: "Mileage", labelPosition: "ABOVE", value: ri!vehicle['recordType!{2d40d6b6-da24-42b0-bb32-60ee92680827}AX Vehicle.fields.{1a1f0038-e506-486c-9ffa-15c44e52061e}vehicleMileage'], saveInto: ri!vehicle['recordType!{2d40d6b6-da24-42b0-bb32-60ee92680827}AX Vehicle.fields.{1a1f0038-e506-486c-9ffa-15c44e52061e}vehicleMileage'], required: false ), a!textField( label: "Vin", labelPosition: "ABOVE", value: ri!vehicle['recordType!{2d40d6b6-da24-42b0-bb32-60ee92680827}AX Vehicle.fields.{5d9f2621-923c-4506-bbe1-c7d2c9a496a4}vehicleVin'], saveInto: ri!vehicle['recordType!{2d40d6b6-da24-42b0-bb32-60ee92680827}AX Vehicle.fields.{5d9f2621-923c-4506-bbe1-c7d2c9a496a4}vehicleVin'], characterLimit: 17, required: false ) } ), a!columnLayout( contents: { a!sideBySideLayout( items: { a!sideBySideItem( item: a!dateField( label: "Date Added", labelPosition: "ABOVE", value: ri!vehicle['recordType!{2d40d6b6-da24-42b0-bb32-60ee92680827}AX Vehicle.fields.{9378f617-853b-4e6a-ae30-ac844e93adfb}vehicleDateAdded'], saveInto: ri!vehicle['recordType!{2d40d6b6-da24-42b0-bb32-60ee92680827}AX Vehicle.fields.{9378f617-853b-4e6a-ae30-ac844e93adfb}vehicleDateAdded'], required: false ) ), a!sideBySideItem( item: a!dateField( label: "Last Maintenance", labelPosition: "ABOVE", value: ri!vehicle['recordType!{2d40d6b6-da24-42b0-bb32-60ee92680827}AX Vehicle.fields.{f8a4fb4d-53c8-49c1-a499-f31ae180a53c}vehicleLastMaintenanceDate'], saveInto: ri!vehicle['recordType!{2d40d6b6-da24-42b0-bb32-60ee92680827}AX Vehicle.fields.{f8a4fb4d-53c8-49c1-a499-f31ae180a53c}vehicleLastMaintenanceDate'], required: false ) ), a!sideBySideItem( item: a!dateField( label: "Next Maintenance", labelPosition: "ABOVE", value: ri!vehicle['recordType!{2d40d6b6-da24-42b0-bb32-60ee92680827}AX Vehicle.fields.{768a037b-0239-4ca1-855b-9eb575d8fb72}vehicleNextMaintenanceDate'], saveInto: ri!vehicle['recordType!{2d40d6b6-da24-42b0-bb32-60ee92680827}AX Vehicle.fields.{768a037b-0239-4ca1-855b-9eb575d8fb72}vehicleNextMaintenanceDate'], required: false ) ) } ), a!fileUploadField( label:"Image", target: cons!AX_DOCUMENTS_FOLDER_POINTER, maxSelections: 1, value: ri!vehicle['recordType!{2d40d6b6-da24-42b0-bb32-60ee92680827}AX Vehicle.fields.{33b69aee-2bff-4582-a8c6-95d5ddec99f1}vehicleImage'], saveInto: ri!vehicle['recordType!{2d40d6b6-da24-42b0-bb32-60ee92680827}AX Vehicle.fields.{33b69aee-2bff-4582-a8c6-95d5ddec99f1}vehicleImage'], required: true ), a!dropdownField( label: "Category", labelPosition: "ABOVE", placeholder: "--- Select a Value ---", choiceLabels: index(local!category,'recordType!{9030da14-57d1-418e-94c7-4feccee2719c}AA REF Vehicle Category.fields.{8587ac12-bc92-4a00-bad1-20d227b29766}value'), choiceValues: index(local!category,'recordType!{9030da14-57d1-418e-94c7-4feccee2719c}AA REF Vehicle Category.fields.{357ad3b5-a7c5-42a6-835d-c653784f6065}id'), value: ri!vehicle['recordType!{2d40d6b6-da24-42b0-bb32-60ee92680827}AX Vehicle.fields.{f39a52e4-1305-4744-977d-babb97b00b40}vehicleCategory'], saveInto: ri!vehicle['recordType!{2d40d6b6-da24-42b0-bb32-60ee92680827}AX Vehicle.fields.{f39a52e4-1305-4744-977d-babb97b00b40}vehicleCategory'], searchDisplay: "AUTO", required: true(), validations: {} ), a!dropdownField( label: "Condition", labelPosition: "ABOVE", placeholder: "--- Select a Value ---", choiceLabels: local!condition['recordType!{eb227701-8262-4e28-8383-21f074f141da}AA REF Vehicle Condition.fields.{374df96f-5bb5-4f8b-aafe-d86f8b3b00ee}value'], choiceValues: local!condition['recordType!{eb227701-8262-4e28-8383-21f074f141da}AA REF Vehicle Condition.fields.{f06500cd-7eef-4495-9c40-52415ec87a34}id'], value: ri!vehicle['recordType!{2d40d6b6-da24-42b0-bb32-60ee92680827}AX Vehicle.fields.{2e001f85-9a62-485c-9dfc-571ce7010b13}vehicleCondition'], saveInto: ri!vehicle['recordType!{2d40d6b6-da24-42b0-bb32-60ee92680827}AX Vehicle.fields.{2e001f85-9a62-485c-9dfc-571ce7010b13}vehicleCondition'], required: true(), searchDisplay: "AUTO", validations: {} ) } ) } ) }, buttons: a!buttonLayout( primaryButtons: { a!buttonWidget( label: "Create", submit: true, style: "PRIMARY", validate: true ) }, secondaryButtons: { a!buttonWidget( label: "Cancel", value: true, saveInto: ri!cancel, submit: true, style: "NORMAL", validate: false ) } ) ) )
For this code, I am getting the error:
Could not display interface. Please check definition and inputs. Interface Definition: Expression evaluation error: Rule and function references cannot be stored in local variables. local!category contains one or more rule or function references.
AFAIK, we are allowed to save the values of rule in a local variable.
Below is the code for rule!AA_QR_REF_getVehicleCategory
a!queryRecordType( recordType: 'recordType!{9030da14-57d1-418e-94c7-4feccee2719c}AA REF Vehicle Category', filters: a!queryFilter( field: 'recordType!{9030da14-57d1-418e-94c7-4feccee2719c}AA REF Vehicle Category.fields.{357ad3b5-a7c5-42a6-835d-c653784f6065}id', operator: "=", value: ri!refCategoryId, applyWhen: a!isNotNullOrEmpty(ri!refCategoryId) ), pagingInfo: a!pagingInfo(startIndex: 1, batchSize: 50)).data
The refCategoryId is an optional input.
Could you please tell me why I am getting this error?
Discussion posts and replies are publicly visible
Hello Ritika,
I noticed an error in the code, which is caused by a missing parenthesis "()" in the function call. The correct function call should be rule!AA_QR_REF_getVehicleCategory(). Additionally, even though refCategoryId is an optional input, you still need to pass it as it's the only required input. In this scenario, you can pass null().local!category: rule!AA_QR_REF_getVehicleCategory(refCategoryId:null())Hope it helps!
Hi Mathurambika M,
Thanks for that advise. It worked. But I am facing another error which I am unable to understand.
The error is as below:
Could not display interface. Please check definition and inputs. Interface Definition: Expression evaluation error at function a!dropdownField [line 123]: AA REF Vehicle Category must be indexed by its corresponding record type fields or relationships
The code after changes looks like this:
What does this error mean and how can I resolve it?
In the dropdown "Category," please adjust the choice labels and choice values. Instead of using the index() function, index the values in the same manner as you did for the "Condition" dropdown.choiceLabels: local!category[recordType!AA REF Vehicle Category.fields.fieldName],choiceValues: local!category[recordType!AA REF Vehicle Category.fields.fieldName]
I did do that. I updated that reply with the screenshot which contains the values which you mentioned. Yet it is throwing the same error.
Could you please tell me where I could be going wrong and what that error actually means?
It seems like your local "condition" contains records of the type Category.
Thanks for the advise. I changed that but no difference in the result.
After modifying the local variable, have you performed another test on the interface to verify the changes?
Yes! This worked. Thank you so much for the quick help!
May I know how testing resolved that issue?
Local variables are not initialised again if you only change the code. Hitting the TEST button will refresh the full context and all variables.