web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Pages / Form create incident :...
Power Pages
Unanswered

Form create incident : Get automatically Customer an Contact fields

(1) ShareShare
ReportReport
Posted on by 26

Hello everyone


 How can I automatically obtain the User name in a Contact field and Company name in Customer field ?

as shown in the screenshot

 

 

oussouss_0-1696521344014.png

 

 

Categories:
I have the same question (0)
  • Inogic Profile Picture
    1,297 Moderator on at

    Hi @oussouss ,

     

    You can execute this query using basic form metadata and with straightforward JavaScript code.

     

    This allows you to auto-populate fields in the portal for the currently logged-in user.

     

    First, create basic metadata within the form where you want to auto-fill the contact field. Ensure the metadata type is set to "Attribute."

     

    For a clearer understanding, please refer to the screenshot provided below.

     

    Inogic_0-1695992092749.jpeg

     

    Then, For the "Company" field, you must implement logic during the form's loading process.

     

    You'll have to provide hard-coded values within the script and assign these values appropriately.(You can provide the Dynamic values within the script)

     

    For the lookup field, you'll be setting three distinct values:

     

    $("#ts_CompanyName_Name").attr("value", CompanyName);

    $("#ts_CompanyName").attr("value", CompanyNameID);

    $("#ts_CompanyName_entityname").attr("value", "EntityName");

     

    Please modify the above code as needed and insert it into the custom JavaScript section.

     

    For a visual guide, kindly refer to the screenshot provided below.

     

    Inogic_1-1695992092751.jpeg

    Save and Sync the Website

    Thanks!

     

    Inogic Professional Services Division

    Power Platform and Microsoft Dynamics 365 CRM Development – All under one roof!

    Drop an email at crm@inogic.com

    Services:  http://www.inogic.com/services/

    Power Platform/Dynamics 365 CRM Tips and Tricks:  http://www.inogic.com/blog/

  • oussouss Profile Picture
    26 on at

    Hello and thank you for your reply

    for your first "screenshot" I had already done it and it didn't work, and I didn't know why!
    no error message appears but the value does not appear in the 'Contact' field.

     

    For the 2nd "screenshot", I use this script and it works fine (see screenshot)

    oussouss_0-1695996985263.png

     

  • Inogic Profile Picture
    1,297 Moderator on at

    Hi @oussouss ,

     

    Based on our analysis, it seems you might not have granted the "Append" and "AppendTo" permissions to the Contact's table.

     

    If the issue persists, please assist us by sharing the basic form metadata of the Contact field from the Portal management.

     

    Thanks!

     

    Inogic Professional Services Division

    Power Platform and Microsoft Dynamics 365 CRM Development – All under one roof!

    Drop an email at crm@inogic.com

    Services:  http://www.inogic.com/services/

    Power Platform/Dynamics 365 CRM Tips and Tricks:  http://www.inogic.com/blog/

  • oussouss Profile Picture
    26 on at

    Hi @Inogic 

     

    thank you for your return, and yes, the problem persists.

     

    *Regarding the 1st point, I have already granted these authorizations to the Contact table.

    oussouss_0-1696409940234.png

     

     

    *For the 2nd point, see Screenshots about 2 metadata ::

    1st metadata for autofill of company name in "Customer" field.==> OK
    with attribute = "customerid"

    oussouss_1-1696410823887.png

     


    2nd metadat for autofill the current user's name in the "Contact" field==> No OK

    with attribut = "contactid"

    oussouss_2-1696410860164.png

     

  • oussouss Profile Picture
    26 on at

    Hello everyone

     

    I've found the source of the problem I mentioned above. In fact, the "Contact" field in the form is actually the "primarycontact" field but with the lebel "Contact" ;

    oussouss_0-1698658352774.png

     


    This is why, when I tried to automatically fill the "Contact" field in the Portal form with a "Contact" value it didn't take it .

     

     

    So, to solve this problem,   I created a new metadata to assign the value of the "Primrycontact" in the "Contact" field, and I can see the magic!

    oussouss_1-1698658685158.png

     

    If you consider it a solution, please give Kudos and accepet as a solution 🙂

     

    THX; Oussama

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Pages

#1
sannavajjala87 Profile Picture

sannavajjala87 38 Super User 2026 Season 1

#2
Valantis Profile Picture

Valantis 35

#3
Fubar Profile Picture

Fubar 23 Super User 2026 Season 1

Last 30 days Overall leaderboard