Ask: Set logged in portal user to a lookup.
Scenario: On a portal form we have a contact lookup with the name educator. On load of the form, the value of the educator look shall be set as the logged-in user.
How to do it: Click on F12 on the portal form to navigate to the designer page. There will be 3 ids available on the form. These Ids will be used to set the display name, record guid, and entity name.
Implementation: Below code will be used on the entity form the custom javascript section.
JS Code:
$(document).ready(function(){
$("#new_educator_name").attr("value",'{{user.fullname}}');//Display Name
$("#new_educator").attr("value",'{{user.id}}');//Contact Id
$("#new_educator_entityname").attr("value","contact");//Name of entity lookup
});
Comments
Post a Comment