We are rendering a case in powerapps portal which has a lookup of customer type(it is pointing to both account and contact). In our scenario we want to restrict a user to select account from the portal form and for that we are trying to write a javascript on change of that field and trying to get the type associated with that lookup value.
Below is the javascript we're trying to write but unfortunately we are unable to get the type.
$('#customerid').change(function () {
// Log the event to the console for debugging
console.log('Change event triggered.');
// Get the selected entities
var selectedEntities = $('#customerid_entityname').val(//);
Is there anything wrong in the script or is their any other way to find out the type of the entity.