cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
D365_Eric
Helper IV
Helper IV

Setting Entity Field Read-Only on Portal page form

Hello Community,

 

I have created a custom portal, linked to a Dynamics 365 instance. On the portal page, I have a form for submission which would then create a Lead record in Dynamics. Does anyone know if there is a way without applying custom codes (if possible) to make a field read-only on the portal page form? It appears even if the field is read-only on the entity form in Dynamics, it's still editable on the portal page.

 

Any pointers would be appreciated! Thank you!

1 ACCEPTED SOLUTION

Accepted Solutions
OliverRodrigues
Super User
Super User

Hi, if you have it set as read-only in CRM form this should reflect in the Portals, have you make sure to publish/clear cache/clear config?

 

if you need in a dynamic way, you can set via JS: 

$("#firstname").attr("readonly", true);

 

------------

If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users find it.

 




If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users find it.

Power Apps Portals Super User


Oliver Rodrigues


 

View solution in original post

7 REPLIES 7
OliverRodrigues
Super User
Super User

Hi, if you have it set as read-only in CRM form this should reflect in the Portals, have you make sure to publish/clear cache/clear config?

 

if you need in a dynamic way, you can set via JS: 

$("#firstname").attr("readonly", true);

 

------------

If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users find it.

 




If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users find it.

Power Apps Portals Super User


Oliver Rodrigues


 

Hi Oliver,

 

Thank you very much for your reply! I have successfully resolved this now after clearing the cache.

 

CRM_HUB
Helper I
Helper I

Hi,

 

Check this one:

https://crmhub.blogspot.com/2017/11/how-to-use-java-script-in-adx-studio.html

 

For more tutorial list , check this one :

https://crmhub.blogspot.com/p/d365-portal-adx-studio-portal.html

 

Keep Learning, keep Sharing , Keep Growing !!!

@OliverRodrigues @D365_Eric @CRM_HUB I'm looking for same solution

Could you please help me on where i need to add the $("#firstname").attr("readonly", true);

So that my field becomes read only

Kindly Advise

Best Regards,

Sumaira Noor

@Sumaira the Portal entities have a Custom JavaScript field and that's where you place your JS code

usually you can add the JS in Entity List / Web Page (localized webpage, non-root) / Entity Form / Web Form Step

there are a few more places you can add but those are the most common

https://docs.microsoft.com/en-us/powerapps/maker/portals/configure/add-custom-javascript

 




If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users find it.

Power Apps Portals Super User


Oliver Rodrigues


 

Hi Oliver

 

The 

$("#fieldname").attr("readonly", false/true) does not work on Drop down attribute.. its converted the control box to grey but the user can still click and see the values in the list and change etc.
 
If I disable the control then the value in it is set to Blank on the save of the form.
 
Thanks
Bik

Hi bik,

 

there's a way to disable drop down attribute as well. Below line of code will disable all drop down attributes on web page.

 

$('.control').find("select").prop("disabled","disabled");

 

Regards,

Hardik Chauhan

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

Carousel News & Announcements 768460.png

What's New in the Community?

Check out the latest News & Events in the community!

MPP IDEAS updated 768x460.png

Ideas

Discover ideas and concepts from users like you for how to use Power Pages and take your work to the next level.

Users online (3,699)