How to auto populate the Customer/Account field from current login user's customer in Dynamics 365 Portals

Summary : How to auto populate the Customer/Account field from current login user's customer in Dynamics 365 Portals

Open your EntityForm or WebForm Step and place the following code on advanced JavaScript field.

Code:

$(document).ready(function () {

    {% if user %}
        $("#customerid").val('{{user.parentcustomerid.id}}');
        $("#customerid_name").val('{{user.parentcustomerid.name}}');
        $("#customerid_entityname").val("account");
        
    {% endif %}
});

In the above code replace customerid field with your field schema name and {{user.parentcustomerid.id}} replace with you field name of user entity.
ex: {{user.yourfieldname.id}}




0 comments:

Post a Comment

Popular Posts