Skip to main content
Nintex Community Menu Bar

Is it possible to prefill a smartform with "data" based on the logged on user ID.

 

I have a Smartobject that uses Smartbox to store the data. I have created an Item View for this smartobject that has a CREATE method. This view has data fields that I could like to prefill based on the current user name (System Values - Current User - Name) and a lookup in Active Directory.

 

This could either be done when the view inizalises or when the user clicks a "Prefill" button on the view or form.

 

I would like to prefill fields/controls like First name, Surname, Department and so forth.

 

I am a complete new beginner with K2 Smartforms, so please explain in basic steps.

I'm not sure if this is exactly the same scenario you are after, but I found a question that looked similar to the one you asked.

http://stackoverflow.com/questions/24682360/populating-k2-smartobjects-from-ad-attributes


Hi Kjell_Magne,

 

This should be fairly easily accomplished.  In a smartform, you can use the context browser to get basic information about the logged in user as shown below.

 

 

From there, you've got a few options.  You can pass the information here (Like FQN) to a method of one of the active directory smartobjects to populate any other fields on the form.  This can be driven by a button (when "button" raises an event), or can be done once the form intializes automatically (when form executed "initialized")

 

Hopefully that gives you a bit to get started on, let me know how progress goes and I can help further.

 

Regards,

 

Mike


Hi 

 

My team is encountering a similar question. We'd like to auto-populate a New form with user attributes from Active Directory (First/Last Name, Department, Office). We have a limited number of options available in the System Values > Current User node of the context browser, but Department and Office are not included. 

 

 

Dragging and Dropping Name or Email into the form fields works and displays proper values. But is there any way to expand the list of Current User attributes here? Do we need to have our IT group that manages Active Directory "publish" additional fields to be available to K2? 

 

We've also tried playing with the AD User smartobject, but it doesn't appear we have the appropriate methods (something like "Get Current User Details") to pull additional fields about the current user. If there's a way to use the AD User SO to accomplish this, please elaborate.

 

Thanks for whatever help you can give!


@Tom,

I think this is what you are looking for. If you try it, let me know how it worked for you?

 

http://community.k2.com/t5/K2-blackpearl/Dynamic-Active-Directory-Service/ba-p/869


Thanks for this! It's certainly an option. We actually found another solution, which was to add the GetUserDetails method to the "AD User 2" SmartObject. (Hopefully I'm remembering those names correctly.) We just went to the Service Methods panel at left, found the GetUserDetails method, and dragged it into the Methods tab of the SmartObject. Utilizing that method allowed us to get the full user details we were looking for. We're very new to K2, and this simple revelation unlocked a lot of possibilities for us.


Reply