AnsweredAssumed Answered

How to add a auto-complete to a field?

Question asked by Alyson Melo on Jan 22, 2018
Latest reply on Jan 23, 2018 by Rolustech Support

I was wondering if it is possible to create an auto-complete to a field on a module.

 

I tried this and worked, however there is no suggestion box:

 

$.ajax({
   beforeSend: function(request) {
      request.setRequestHeader("OAuth-Token", SUGAR.App.api.getOAuthToken());
   },
   url: "rest/v10/Accounts/filter",
   data: { "filter[0][name][$starts]": $('input[name="account_name"]').val(), "fields": "id,name", max_num: 5 },
   dataType: "json",
   type: "GET",
   success: function(data) {
      response(
         $.map(data.records, function(obj) {
         returnlabel: obj.name,
                     value: obj.name,
                     id: obj.id};
      })
     )
   }
});

Outcomes