How to handle invalid reference in reference type

sowmyaj
Giga Expert

Hi All,

How to I catch the invalid reference in reference fields, ex. I have three condition to put in on reference field,        

                                                                              1. I need to populate related information when the value exists in reference table -Good with it.

                                                                                2. Onchange of the field if no value is selected which means the value is null, I need to take some action - Good with it.

Finally comes with the 3rd action which I'm not able to track, 3. If i enter some junk value in reference field and which is not exists in reference table as shown below, find_real_file.png

then, I need to alert the user saying that the value doesn't exists. How can I achieve this. Please let me know if anyone is having answer for it.

I referred one of community links "Need to add an alert when there is an Invalid Reference in a Reference field " which says get the value of form for particular field and if I did so, the alert is getting populated twice with null value for third condition.

Thanks,

Sowmya

1 ACCEPTED SOLUTION

Shishir Srivast
Mega Sage

Hi Sowmya,



Entering wrong value is making the field RED, that it self is an indication that the value is wrong and even when submit the form that system will not save the invalid data. So i think there is no need for a client script for validation since its not accepted.



You can make the field mandatory so that it wouldn't be allowed to submit the form without entering the value.


View solution in original post

5 REPLIES 5

Based on your requirements, I recommend what Shishir has proposed also.



You cannot detect an invalid entry with a client script or UI policy (to show/hide fields). You need to have a proper/valid value with which to do that. "Other" or "Not found" seems like the logical choice - or a separate true/false checkbox that indicates "I couldn't find my value in the list". If they check that, the reference field is hidden and the text field is displayed.