0

We are using third party tools for record management in SharePoint 2019 and we have custom search page to display custom search results. For this managed properties have been defined mapping to third party application metadata.

The value being returned by 3rd party application for one of the field is Yes but SharePoint managed property shows it as True. Is there a way to put a logic in display template to check if Value is true, convert to Yes before displaying it on Page?

1
  • I am checking to see if you have any chances to see my answer, If you have any concerns, please feel free to reply.
    – Kally
    Commented Jun 26, 2023 at 7:23

1 Answer 1

0

To change the display template in SharePoint 2019 Server to show "Yes/No" instead of "True/False," you can follow these steps:

  1. Navigate to the Site Settings page:

    • Click on the gear icon in the top-right corner of your SharePoint site.
    • Click on "Site Settings."
  2. Under the "Web Designer Galleries" section, click on "Master pages and page layouts."

  3. In the "Master Page Gallery," locate the "Display Templates" folder and click on it.

  4. Locate the "Content Web Parts" folder and click on it.

  5. Find the display template you want to modify (e.g., "Item_TwoLines.html") and download it to your local computer.

  6. Open the downloaded HTML file in a text editor (e.g., Notepad++).

  7. Locate the code snippet that renders the "True/False" value. It should look similar to this:

    _#= ctx.CurrentItem.YourBooleanFieldName =#_
    
  8. Replace the code snippet with the following code:

    _#= (ctx.CurrentItem.YourBooleanFieldName) ? 'Yes' : 'No' =#_
    

    Replace "YourBooleanFieldName" with the internal name of your Yes/No field.

  9. Save the modified HTML file.

  10. Go back to the "Content Web Parts" folder in the "Master Page Gallery" and upload the modified HTML file. Make sure to overwrite the existing file.

  11. After the file is uploaded, perform an "IISRESET" on the SharePoint server or clear the browser cache to ensure the changes take effect.

Now, the display template should show "Yes/No" instead of "True/False" for the specified field.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.