Right now we made a lookup field as mandatory but if user not selecting any lookup item and trying to save it’s just showing a red border over text field. The expectation is it should display a message like this field is mandatory. How to do that?
Probably the simplest way to do this is to convert your save button into a “multiple actions” button. Then start the action with a branch. The logic for the branch should test whether your reference field is blank. If this logic is true - then take some action to notify the user. You can either expose a modal with that message, or toggle a set of components right on top of the field, that provides that message.
In the V2 page API - we have introduced Toast Messages - small warnings that can be configured to pop up at the bottom of the page. This UI elements provides a subtle warning for your users.
Finally - if you want to use Salesforce validation messages, you can expose “in line” error messages in your Form - and the salesforce generated error will be shown above your field.