How to fill Lookup control by current user?


Badge +1

Is it possible to fill lookup control with current user data from AD Users SmartObject ?


 


 


11 replies

Badge +9


The default AD User SmartObject does not have a Get List
method, so I assume when you try to associated the AD User SmartObject with a
dropdown list you can select a method, is this assumption correct? If so read
on…. 


You can extend the AD User SmartObject by adding a new
method, from the ServiceObject Methods select the “Active Directory Service2
> AD User > GetUsers” method, give the method an appropriate name and
Auto bind the properties. Deploy the AD User SmartObject and should be set.


On your View, select the dropdown list you want to populate
with AD Users and configure the Data Source properties, you should now see the
new method added in the previous steps. One thing to be aware of, if you have a
large org with thousands of users in AD you might see some slow responses in
loading the data, think about narrowing the data down by applying filters to
limit the number of users you populate


Badge +1

Thanks.


I've already added this method and another one - GetUserDetails


I was wrong that I need to fill Lookup control,


I need to fill Picker Control.


Data source of the Picker Control is AD User.


I can call GetUserDetails method, I get Display name, but  mapping of Display Name to Picker Control Does not work. Mapping of Name to Picker does not work either.


 

Badge +9

Thank you for posting additional info, i would recommend opening a support ticket for this, also if you can please update the post based on the feedback you get from the support team

Badge +4

Hi Vladimir,


 


did you get a solution to this from the K2 support team ?


I am trying to fill in a text box, on an initialize event, with the result of a smartobject invocation and it's not working.


I have tested the smartobject in Service Tester and it returns 1 result.


 


Thank you,


Tiago Calado

Badge +9


Hi Tiago. Are you making use of a “Execute a SmartObject
method”? did you check that the Output mappings are configured correctly? You should
have no issues with this. 


Vladimir’s question is slightly different as he is making
use of the picker control combined with AD Service methods that seems to cause
an issue.


Badge +4

Hi Renier,


you are right. It is working fine now. It was a training issue.


Thank you


 

Badge +6

Greetings,

How can I get the current logged in user name? As I need to display it in the Smartform header form, any idea aroud this?

Thanks,
Aman

Badge +2

Here are steps to achieve it.


-Create SmartObject using Active Directory.
-Define Properties like EmpNo, Employee Name, Designation etc.
-Create View.
-Select the SmatObject and drag the fields on the Canvas Layout.
-Create New Rule -> “When the View executed Initialize”
-In Events -> View Events -> Select When the View executes a <<method>> (select Initialize)
-In Actions -> Smart Object Interaction -> Execute a SmartObject method.
-Select Execute a SmatObject method. (it with <<SmartObject Name>> and <<Method>>)
-Select Configure -> In Input Mappings – select email or FQN from Context Browser -> System Values -> Current User -> FQN or Name or Email (depends)  as Input parameter to AD SO method (Getlist)
-Your View is ready with User details.

Badge

Thanks for your help hemantnehete i tried it nice, thanks again.

Badge

During new form/view loading I can see that data from active Directory for specific field is there (inside field) but when a new form/view is loaded completely, then the data in these fields disappear and Then I have to select all the data again from the drop down list. What should I do that data retrieved from active directory is not lost during complete loading of a form or view?

 

13215iF3A56C38483AB4D7.jpg

Userlevel 5
Badge +16

Dear,
1- when the viewform executed initialize
AND
2- when the viewform executed initialize
make sure in the previous methods you are not clearing views transferring empty string to your fields

 

 

 

Reply