Community
Showing results for 
Search instead for 
Do you mean 
Reply

Set DetailView to readonly

Copper Contributor
Posts: 29
Country: Germany

Set DetailView to readonly

Hallo,

 

is there a function to set the details view of a contact layout or all fields on a layout via sdk to readonly?

There is a request to set all fields on a layout to readonly when the contact has a special value in the ID Status field.

 

Thanks for any idea in advance Susanne

 

 

Administrator
Posts: 221
Country: United States

Re: Set DetailView to readonly

No specific function, There may be two different approaches to look into...
#1. Get field descriptors and set them to read only if it's accessable (Try setting enable=false as well)
#2. This one may be a hack I'll admit, but browse users are read only, you may be able to swap the current users access role to "Browse" and then set it back to whatever role it was... Make sure to do this in the onbefore event for contact detail view page, and the OnAfter event to switch it back.

Don't have code in front of me right now, but that's how I would approach this thought the API
Copper Contributor
Posts: 29
Country: Germany

Re: Set DetailView to readonly

rian

 

thanks for your ideas.but they are not working for me:

 

#1: can only be changed when all users are logged out

#2: the user can not switch his role itself only if he is an administartor

 

Best regards Susanne

Nickel Contributor
Posts: 175
Country: USA

Re: Set DetailView to readonly

Just a thought, but could you possibly find the appropriate control on the form and set it to read only? You'd have to loop through them all until you find the one you need. I recall something similar to that being posted on these forums a while back. It may have been dealing with the menu tree, not form controls though.

Copper Contributor
Posts: 29
Country: Germany

Re: Set DetailView to readonly

Hallo Knif,

 

that was my first idea and it is working if the enduser has an layout with a few number of controls.

But if the layout is overloaded it slow down the system ...

 

Any other ideas?

 

Thanks in advance Susanne