Change Search Select Advanced field to Selection in Self Service

By | July 13, 2012

Search Select Advanced is one of the nice to have feature of Sage CRM. It enables you to search the records on the fly, also provides you the find screen for detailed searching of an item we are looking for. However it doesn’t seem to work correctly on the self-service portal. I add SSA field on Case screen in CRM it works great, but if I add the similar field to the selfservice screen the default behaviour seems like lost. Check below screens.

Similar field when added to Self-service screen it looks like below but dies not work.

So if you have comparatively less number of items, a better option is to replace the field with Selection field at runtime. Below is the basic approach you can take to do the same.
1. Make the field readonly.
     var EProduct = BlockObj.GetEntry(‘case_product’);
     EProduct.ReadOnly = true;
2. Create HTML for selection.
     var ssaHtml = ‘<select size=”1″ name=” case_product ” id=”case_product”>’;
     ProdSql = ” SELECT prod_name, prod_id FROM Products (nolock) “;
     ProdSql += ” WHERE prod_deleted IS NULL “;
     recVals = eWare.CreateQueryObj(ProdSql);
     recVals.SelectSql();
     var foundSelected = false;
     while (!recVals.eof) 
     {
          ssaHtml += ‘<option value=”‘ + recVals(“prod_id”) + ‘”>’ + recVals(“prod_name”) + ‘</option>’;
          recVals.NextRecord();
      }
      ssaHtml += ‘<option value=”” ‘ + (foundSelected ? ” : ‘selected=”selected”‘) + ‘>–None–</option>’;
      ssaHtml += ‘</select>’;
 
3. Add HTML to field caption  
     EProduct.Caption = eWare.GetTrans(“ColNames”, “ case_product “) + ‘:<br />’ + ssaHtml;
As we are using standard field names here Self service screen saves data correctly in the corresponding table.