Creating a pickerFieldCustom with a REST API result

Hello World,

In the Appian interface I am working on, I need to create a user picker. I can't use the default pickerFieldUsers component because the list of available users come from a REST API call. So, I am thinking to use a pickerFieldCustom component but I don't know how to build the suggestfunction property with the REST API call result.

Any help will be welcomed!

best,

  Discussion posts and replies are publicly visible

  • Hi Sebastien,

    This is not a direct answer to your question, but would you consider an alternative approach that involves calling the rest API in advance of loading the interface that contains the picker?

    Provided that the user list isn't rapidly changing every second, would it be acceptable to periodically retrieve the latest copy of the user list and either load it in a local variable or write it to a data store entity? One you have the data in Appian, in a non-volatile state, configuration of your picker should be less of a challenge.

    Your use case and performance requirements could help you decide whether you will want to update this list every time the form is loaded, or on a regular cadence, independent of when the form is loaded.
  • Hi Robert,

    The alternative approach you are suggesting to me is basically my second plan. Before to try to implement it. I was just curious to know if someone already implemented that kind of component by calling directly the Rest API in the picker.

    The second plan could be mainly acceptable by my customer especially if we bring toward the performance perspective. The other considerations regarding the cadence of the update, etc. could be discuss later.

    I think that I am going to implement the alternative approach right now!

    Thank you Robert for your thoughts.
  • Hi Sebastien,

    Apart from performance issue and all(totally agree with what Robert has suggested here), if you really want to implement with the help of REST API, so you need the array of data(data is here your users).

    1) first create Integration object and integrate your REST API here.

    2) now create a process model and use call integration smart service and store the body of the result in a process variable and create a array with the help of result(i am assuming here REST API result will hold the users list). so now you have the required array.

    3) pass this to your interface as input parameter and you have the main thing which you want , now you can play as you want.

    i have not implemented this but what i see main problem is getting the users list from REST API and passing to your interface so you can pass this to your custom picker field .

    Regards
    Abhay