Sage CRM 2017: Fixing the "Favourites" feature for a Custom Entity

Hints, Tips and Tricks

Technical Hints Tips and Tricks that cover customization and development using Sage CRM. API usage and coding are covered.

Sage CRM 2017: Fixing the "Favourites" feature for a Custom Entity

  • Comments 11
  • Likes

Sage CRM 2017 has a great feature – Favourites. All primary entities have the ability to mark them as favourite and access them easily from user Favourite list.

We can extend this feature for custom entities as well. If you have used Advanced Customisation Wizard to create entities you will not have any issue (unless meta-data has been altered) - including those custom entities created in earlier version using wizard will work once you upgrade to Sage CRM 2017.

Nevertheless, some entities might have issues especially when they were not created using the wizard. Symptoms of issue are different for each issue.

In some cases, the user can include a custom record in favourites list, but upon clicking on the link it fails to display the record and gives an error. Whereas, in certain cases when you click on Star icon to make custom record favourite and nothing happens – The icon colour remains unchanged suggesting the record is not marked as a favourite.

Below are some basic troubleshooting steps to isolate and fix the issue:-

  1. This feature is depended on SData, it’s a JSON request
  2. In which case, make sure your tomcat features like dashboard and Calendar pages are working.  See Checking System Health in the Help Center (http://help.sagecrm.com/on_premise/en/2017R2/administration/Content/Administrator/SS_CheckingSystemHealth.htm)
  • If user is not able to get it to work when they click on the Favourite icon or when revisiting the custom record the favourite icon is not marked then
    1. Check if your entity is setting the context correctly.
    2. Your entity should have CRM.SetContext() method included in the JavaScript of the ASP summary page.
  • If user can see the custom entity in the favourite list but upon clicking the link user is gets an error
    1. Run Fiddler (http://www.telerik.com/fiddler) you will see a JSON response like in the screenshot below
    2. OR use browser ‘Inspect’ Element feature to examine data for your custom entity record in favourite list

    3. Both will show Href/recordUrl attribute of the favourite item being blank

    4. If this is the case make sure Bord_EntityKind and Bord_ViewFileName are not blank for the record that describes the entity in the metadata table custom_tables.
    5. Bord_EntityKind should be set as “asp”
    6. Bord_viewFileName should be set as a summary page of a custom entity.

    7. Do full meta-data refresh and your favourites should now work.

Comments
  • Is there a similar fix available for the Quick Find as well ? I have the same issue doing a quick find on a custom entity in that it does not do anything when clicking on the link.

  • Chris - it might be worth checking the QuickFind index status in the Admin/System/Quick Find area, and restart the service there also if required.

    To rebuild the index, click change, uncheck one entity (e.g. Solutions) and click Save, this does a complete rebuild (make sure all your custom entities are checked).

    It's also worth checking that your Custom_Tables table has upgraded correctly (if this is an upgraded system) - I saw a similar click issue recently where the bord_name field was defined as nchar(40) and should have been nvarchar(40). Updating that and doing an rtrim of the contents solved a click issue that someone was having.

  • Hi Guys,

    Just fixed a typo in above blog I had originally mentioned  'Bord_ViewAction' which is for standard entities instead of 'Bord_ViewFileName' which is for custom asp pages.

  • Hi Chris,

    When you say nothing is happening are you getting any error or once you click record link from Quick Find result it does not respond to click event?

    Both the Favourites and the Quick Find use the bord_ViewFileName field to form the URL that the item in the list will link to. If the value in this field is blank or not correct, the URL will be malformed and you are likely to get an http 404 error or an http 500 error depending on how IIS has been set up.

    Have you checked if the URL has been built correct or if it is blank ?

    This can be done a number of ways, the easiest in my opinion, if the link is responding to the click event, would be to right click and open in new Tab. The URL will be present in the address bar.

    Hope this helps, please let me know how you get on with this issue.

    Thanks

    Ravi

  • Thanks for all the responses.

    The Bord_ViewFileName field was blank in this instance. I have updated it to point to the entity the summary page and now it all works.

  • Once other thing, when the list appears in the quickfind it is displaying  next to the icon. How do I update this to display a field from the custom entity instead ?

    I can see in the JSON Response that "content " is set to "" :

    {"queryString":"12345/1","entitiesToQuery":[],"searchResults":[{"entityName":"Visit","crmid":27040,"recordEntity":null,"forEntity":true,"content":"","imageUrl":"/crm/Themes/Img/ergonomic/Icons/Visit.gif","summaryPageUrl":"/crm/CustomPages/Visit/VisitSummary.asp?SID=62122079645359&J=Visit/VisitSummary.asp&E=Visit&visi_VisitID=27040","territory":-1073741819,"channel":null,"assignedTo":null,"createdBy":40}],"message":null,"recordsFound":1}

    Thanks for your help!

  • Hi Chris,

    Thanks for confirming the issue with the link is fixed.

    For the issue with content being blank, there are a couple of areas you can look at. Sage CRM manages view field differently for different features.  For example, the recent list will use SS_ViewFields; some features would use Bord_RecDescriptor from Custom_tables value for that particular entity.

    Most likely, quick find is also using SS_ViewFields to determine the display field.  With my limited testing, I can see this is building correct SQL for Quick Find content attribute. You can check this SQL in “data-config.xml” under “…\CRM\QuickFind\instance\conf” folder.

    Please check above file and examine query attribute for your custom entity. See which field is being used to get the index_descriptor field. If it is blank then try setting SS_ViewFields & SS_SearchTables in translations for your custom entity, followed by full meta-data refresh. Close any open file from above folder to make sure file gets rebuilt. You should now see correct SQL with index_descriptor alias field.

    You might have to force rebuilt of quick find index – please use Tom’s trick from his comment. See if that gets correct query generated for your custom entity in data-config.xml file to start with and run that SQL in SQL management studio if needed.

    This is a great topic of discussion, I will write up a blog with more details on the Quick Find.

    Hope this helps.

    Thanks

    Ravi

  • Thanks for the info Ravi, very useful indeed.

    I agree some blog posts going "under the hood" of the Quick Find would be great. I have spent many hours on this, so if it helps other people save time in the future it can only be a good thing!

  • Hello again! I managed to get the Favorites working with one custom entity , but not another following the above steps. Is there anything else I can check ?

  • Don't worry it seems to have fixed itself now!

  • Hi -

    with regards to the issue of what appears after the QuickFind custom entity project icon, by default the system assumes that there is an xxxx_name field being used on your custom entity (xxxx_name being say proj_name for custom entity Project). This _name field is always there on a table created by the custom entity wizard, and on the basis that something had to appear, that field was the chosen default.

    However, if you go in to the custom_tables table, you will see a column Bord_RecDescriptor, which does have values for the Cases, Company, Person tables etc. You can enter a value in the field for your custom entity record (in my case I used #proj_name#:#proj_description# but you can try other text field values).

    The trick with this though is that having made your change, you must update the bord_createdby/bord_updatedby and bord_timestamp fields for this record to the current time (or say T+2 mins), in order to cause the QuickFind to pick up your change. If you don't do this (or, as happened to me, do make the change, but are too slow about it) the QuickFind decides there's nothing new here, and your changes never, ever get picked up (even after machine reboot).

    You can also change the values for the core entities (and the separator between multiple fields) if there are other text fields that work better for you.

    Note: The above is untested except in my dev playground, please back up etc. as fiddling with the metadata tables is completely unsupported!.