I have a NewForm to enter data in Sharepoint called NZ Jobs Cost
My SharePoint columns (single line of text) are Job#, Client, Job Name, Mgr, ID ( automatically generated ID# for each entry) and a choice column name Ledger.
Choices on Ledger column are Contractors and Subcontractors. I want it to validate that Ledger was selected upon hitting submit and if not, show error on the ledger datacard saying "Please select ledger" so the user can go back to the form and select ledger then hit submit again to add entry to SharePoint.
I also want the app to check if the same Job# and Ledger already exist in SharePoint before adding the new entry. If it does exist, I have a pop up that would say " Job# and ledger already exist". If it doesn't, then it will successfully add row in SharePoint and it will show my pop up - "varSuccess"
I put this formula on the OnSelect property of the Submit Button:
If(IsBlank(DropdownLedger.Selected.Value), Notify("Please select ledger"));
Set(varRecord, LookUp('NZ Jobs Cost', Job# = 'Job#'.Text & Ledger.Value = DropdownLedger.Selected.Value));
If(IsBlank(varRecord.ID), SubmitForm(NewForm), UpdateContext({varSuccess: true}), UpdateContext({varShowX: true}))
Upon hitting submit button, if nothing was selected on DropdownLedger, a notification at the top says Please select ledger - I need this notification to show on Dropdown DataCard itself as error message - How can I do that?
Also, Any record gets submitted even if there's a notification at the top saying Please select ledger. It seems my lookup doesn't work as well as same Job# and ledger gets added multiple times.
Can you please let me know what am I missing? Appreciate your help. Thanks!
Cheers,
Troy