Hello!
I think I may have encountered a bug, or I'm simply missing something. I have made an app very similar to the one described in this thread. It works as intended, except I sometimes receive the error message "Title: Field 'Title' is required" when I press the Submit button. Even when the error appears, the records are created successfully.
I originally renamed the Title column to EquipmentID. I have tried to eliminate the error message in these ways:
- Change EquipmentID to Title in the OnSelect code
- Rename the EquipmentID column back to Title in the SharePoint list
- Make the EquipmentID column not required in the SharePoint list
Again, the app always works fine, but I would like to get rid of this weird error so users don't think that something went wrong. If anyone has any ideas on how to fix this, I would greatly appreciate it. I have added my Submit button's OnSelect code below, but if any other details would be helpful don't hesitate to ask.
Thanks in advance,
Matt
(Also, I'm very new to Power Apps, so if you notice any other ways I could improve my code, I'd love to hear them!)
Submit button OnSelect code:
ClearCollect(
colCounter,
FirstN(
NumberCollection,
Value(QuantityInput.Text)
)
);
Set(
IDPrefix,
Left(
EquipmentTypeDropDown.Selected.Value,
1
) & Text(
PurchaseDatePicker.SelectedDate,
"[$-en-US]yymm"
)
);
Set(
LookupRecord,
LookUp(
'Matt Test 2',
ThisRecord.Prefix = IDPrefix
)
);
Set(
PrevIndex,
If(
IsBlank(LookupRecord),
0,
LookupRecord.LastIndex
)
);
Clear(colNewRecords);
ForAll(
colCounter,
Collect(
colNewRecords,
Defaults(EquipmentIDs),
{
Title: IDPrefix & Text(
Value(PrevIndex + ThisRecord.Value),
"[$-en-US]0000"
),
PurchaseDate: PurchaseDatePicker.SelectedDate,
EquipmentType: EquipmentTypeDropDown.SelectedText,
Manufacturer: ManufacturerDropDown.SelectedText,
Model: ModelInput.Text,
Comments: NotesInput.Text
}
)
);
Patch(
EquipmentIDs,
colNewRecords
);
Patch(
'Matt Test 2',
If(
IsBlank(LookupRecord),
Defaults('Matt Test 2'),
LookupRecord
),
If(
IsBlank(LookupRecord),
{
Prefix: IDPrefix,
LastIndex: PrevIndex + Value(QuantityInput.Text)
},
{LastIndex: PrevIndex + Value(QuantityInput.Text)}
)
);
Navigate(
ResultScreen,
ScreenTransition.Cover
)