Site structure
Version 5.x > Site structure > Document type View modes: 
User avatar
Member
Member
celsopaulo_bronze-hotmail - 1/26/2011 3:50:28 AM
   
Document type
I want to create a new document type, but I want it, when it is being filled, one of the fields are automatically filled in, depending on the user profile that are filling out the form. Please, where and how can I add this code to the document type.

User avatar
Kentico Consulting
Kentico Consulting
kentico_borisp - 1/28/2011 3:58:45 PM
   
RE:Document type
Hello,

I would suggest you to create a custom form control in which you would get the current users id or login and fill out the value according to this. To get information about the current user you can use the CMSContext namespace:

CMSContext.CurrentUser.UserID;

For more information about our API please see our reference.

Best regards,
Boris Pocatko

User avatar
Member
Member
Harish - 3/2/2011 6:02:47 AM
   
RE:Document type
Hi Celso,

Boris P's reply is very good, we can do in another way.
Try this idea, first set default value of the column to {%FullName%} or you can use below list of macros
{%UserName%}.
{%FirstName%}
%LastName%}
{%Email%}
or you can do like this {%currentuser.userid%}

So, it will automatically brings up the current user details to that textbox.
Here we no need to create custom control also. :)
you can also get more details here http://devnet.kentico.com/docs/5_5r2/devguide/index.html?developing_form_controls.htm

I hope it will be helpfully to you. If you want any help, you can reply to this post.

Thanks,
Naga Harish.
Share Our Ideas

User avatar
Member
Member
Harish - 3/2/2011 6:43:13 AM
   
RE:Document type
Hey, Sorry I just miss linked it seems here is the right URL http://devnet.kentico.com/docs/5_5r2/devguide/index.html?appendix_a___macro_expressions.htm