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 / Auto-Populate a field ...
Power Pages
Answered

Auto-Populate a field between Accounts and Case entities in Customer Self Service Portal

(2) ShareShare
ReportReport
Posted on by 1,712

Hello,

Recently, I have installed the "Customer Self Service Portal".

I have added in the "Case" entity a Country field (Option Set) which contains a list of countries, and I have created another Country field (Option set) in the "Account entity".

 

Account Country Image 
Case Country Image 

 

What I want to achieve is the following:

When I open a new case with a current user, the customer and contact field by default are auto-populated for this user.

 

Demo 

Therefore, I want to implement the same process to auto-populate the country value from the "Account" entity for this current signed-in user and make this field as "Read-only or (disabled)".

As a result, when I click on "Open a new case" the country field will be filled for the users so they don't have to choose the country from the drop-down.

Can someone please explain in detail and provide an example to achieve the following scenario?

Any help would be greatly appreciated.
Thank you!

Categories:
I have the same question (0)
  • Verified answer
    Satish1024 Profile Picture
    279 on at

    You can add custom JS to do client-side manipulation easily by jQuery. This can be done by editing the entity form.

     

    Assuming that you have a country field stored on portal user (contact) entity:

    then, with Liquid Object, you can access {{user.field_logical_name_on_contact}} 

     

    $(document).ready(function() {

    $("#field_logical_name_on_case").val({{user.field_logical_name_on_contact}});

    });

     

    OR

     

    If you don't have country field on contact (portal user), then you can use account also. 

    // Replace GUID of account

    {% assign account = entities.account['936DA01F-9ABD-4d9d-80C7-02AF85C822A8'] %} 

    $(document).ready(function() {

    $("#field_logical_name_on_case").val({{user.field_logical_name_on_contact}});

    });

     

     

    Thanks

    Satish

    https://pascalcase.com

     

  • EBMRay Profile Picture
    1,712 on at

    Hi @Satish-Reddy ,

    Thanks for your reply.

    Actually, I am new to the PowerApps portal and I am still learning this.

    1. The country field stored on Accounts not (Portal Account) here is a screenshot:
    CaptureaCC.PNG

    This field should be in (Portal Account Form)?

    2. How to get the GUID of the account based on the current user signed in?
    In case, if I specify a GUID account it will only fetch the results for this account, so it should be based on the current user signed in.

    3. Do you mean field logical name which is the one that I highlighted in the screenshot below?
    Capture1.PNG

    If yes, and I have replaced the code you mentioned with this form below, how this jQuery code will read this field name since I haven't initialized a variable for this logical field?

    {% assign account = entities.account['CURRENT USER SIGNED IN'] %} 
    
    $(document).ready(function() {
    
    $("#new_countryofaccount").val({{user.new_countries}});
    
    });

    4. This code should be added inside the Web Template of Customer Service - Create Case?

    I would be most grateful if you could provide screenshots of the following scenario so I can understand everything.

    Looking forward to your response.
    Thanks again!

  • Satish1024 Profile Picture
    279 on at

    1. Not 100% sure. Let's keep the attribute on the portal form, to be on the safer side. 

    2. I can see Contact and Customer (not sure what is the customer here, account?) on the case form (Demo link).

    If one of them is the account, you can get account GUID from jQuery. Or If account and contact are related in CRM, then you can retrieve something similar to this

    {{user.parentcustomerid}}

     assuming parentcustomerid is the lookup field.

    3. That's the correct way of getting a logical name. I didn't understand later part of your question here. We are using Liquid Objects here. More documentation on liquid here: https://docs.microsoft.com/en-us/powerapps/maker/portals/liquid/liquid-objects

    4. Not a web template, there is a JavaScript code window where you can write behind the page of the entity form. 

     

    Considering the state we are in, I guess we need to go back and forth on this thread. We can do remote desktop and I can help by connecting to your instance if that's okay. Let me know your timezone, I am in IST. I am signing off for the day. 

  • EBMRay Profile Picture
    1,712 on at

    Hello @Satish-Reddy ,

    Thanks for the screen share, and your support.

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the April Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Pages

#1
11manish Profile Picture

11manish 42

#2
Valantis Profile Picture

Valantis 24

#3
omkarsupreme Profile Picture

omkarsupreme 23

Last 30 days Overall leaderboard