Skip to main content

Hi Everyone.

 

I wanted to populate the user field on selection of dropdown value. How I can achieve this in K2 smartforms. It should be like lookup based on dropdown selection and populate the value in people picker.

 

Thanks,

Prafull

Hi Prafull,

 

 

  • Drag and drop Dropdown list control on View Canvas.
  • Under properties add data source for this control.
  • Similarly drag and drop Picker control on View Canvas.
  • Under properties add data source for this control. under catasource config.. in filter properties select the field which is containing details same as display property of DDL control.
  • Now Add event rule  ”when DDL control changed “
  • Add Action rule “Execute control method”
  • In Action rule under configure for input mapping, under picker control parameter  map “value“ with DDL control.(just drag and drop ddl control from context menu)

  Let me kow if this helps you.

 

 

 

 

 


Hi Karan,

 

Thanks for the solution.

 

I have created one list which has users for each dropdown value. I am using this list smartobject as datasource for people picker control. So based on selection of dropdown value its searching the user value through smart object with filter as dropdown selected value. Its filtering and getting the user value from the smartobject as explaind by you.

 

But, the problem is, its returning user ID value not the display name. Also when I am trying to save the form, it trying to save the value of dropdown selection in people picker and hence giving an error that the value does not exist. Please find attached screenshots for more details.

 

Please correct me if I am doing anything worng. 

 

Thanks,

Prafull






Hi Prafull,

 

You picker configuration looks fine, can you confirm  what values users and users(value)  fields are returning.


Hi Karan,

 

Its returning the correct value, but while saving the form its not able to resolve the value for people picker as its taking the filter value as people picker value which I am passing for filter and that is not user value.

 

It should ideally assign the return value people picker control after filter, but in the form for display its showing correct value in people picker control but in backend it is using the same value which I maped for filer.

 

Thanks,

Prafull


HI Prafull,

 

To fix these issues follow below step.

 

1)  For Rule "When Picker is Resolving" do the below changes (this rule will be automatically generated when you map datasource)

 

  • Edit this rule and and then click on configure link on  "asynchronously populate Picker1 list control with data (configure)" action Rule.
  • Drag and drop DropDownList control  from context browser for Input Properties field  which is identifier in "picker control".

this will help you to get name in place of ID in picker control when you select some value in DDL.

 

2)  while submitting the data Picker control and DDL control will return only ID not value. To get the value follow below steps

  • Expend the control in context browser whose value you want and then  Expand the associated SmartObject and drag and drop field you want to send in form during submission.

Let me know if this helps you.


Hi karan,

 

This is also not working. It uses identifier value for people picker and try to resolv user which is the Title not user field.

 

Thanks,

Prafull


Reply