Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Pages - General Discussions
Unanswered

Populate a field with an 'Anonymous Contract' when user is not logged in.

(0) ShareShare
ReportReport
Posted on by 2

Hello 

New to Power Pages Management / Power Pages.

I have a form with a column called NAME which has the data type of Customer. I have successfully managed to get NAME populated with the user who is logged in to the Portal, by using Basic Form Metadata, Attributes. 

BOB007_0-1708352608970.png

Is there a way that when the form is being used by a user that is not logged in, I can auto populate the NAME column (which I will hide) with the contact of 'Anonymous Contact'? (Which I’ve created as a contact) 

BOB007_1-1708352608974.png

 

 Thanks in advance of any help.

Categories:
  • Fubar Profile Picture
    7,960 Super User 2025 Season 1 on at
    Re: Populate a field with an 'Anonymous Contract' when user is not logged in.

    Personally, I would create 2 Pages and two forms then use access control rules to show them to the different Web Roles.

    You could set your Mandatory to optional in Dataverse, and then on your dataverse use Business Rules or JavaScript to set it Mandatory if you need it in a Model Driven app.  For the portal you can set field that is optional as mandatory either by adding a Metadata record to the form, or via JavaScript/JQuery.

     

    If the field is optional another option is to have a realtime workflow or plugin that populates it if it is empty (if done via a plugin you can also detect the operation is coming from the Portal)

  • littlefoot Profile Picture
    2 on at
    Re: Populate a field with an 'Anonymous Contract' when user is not logged in.

    Hi,
    I appreciate your suggestions/help.
    I apologize for not mentioning that the NAME column is required.
    Therefore, option 1 is not feasible - we cannot leave the field empty.
    As for option 2, I think the NAME column has to be filled in for the form to save, so we need some way to populate it.

    Option 3, creating a separate form, sounds good.

    Would there be any other suggestions/alternatives.

  • fm_skeller Profile Picture
    277 Super User 2025 Season 1 on at
    Re: Populate a field with an 'Anonymous Contract' when user is not logged in.

    Is this purely to show that this record was created by an anonymous user in the canvas app?
    Option 1 would be to just leave the field empty; but it's not very user friendly of course.
    A second option would be to run a power automate flow after the record has been created - check if the NAME field is still empty and if so, populate it with the GUID of the "anonymous contact".

    A third option would be to create two separate forms, 1 for logged in users that stores the user's contact id and another one storing the guid of the 'anonymous contact' - more work from a maintenance perspective. but in this way you can solve it with pure power pages functionality. You could use liquid to switch between the two forms

    {% if user %}
    {% entityform id: "<Guid of basic form that stores the user id>" %}
    {% else %}
    {% entityform id: "<Guid of basic form that stores the anonymous id>" %}
    {% endif %}

     or have two pages with web page access control rules.

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

Michael Gernaey – Community Spotlight

We are honored to recognize Michael Gernaey as our June 2025 Community…

Congratulations to the May Top 10 Community Leaders!

These are the community rock stars!

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

Leaderboard >