Table query not working
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-30-2022 02:45 PM
Hi
I am trying to run a background script to print the names of some templates on the sn_hr_core_template table.
When I run this query it does not print anything. If I enter that query in the list view it displays the records, so I am confused what is wrong with this script?
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-30-2022 03:05 PM
Hi Mike,
Are you sure you don't want to target the "sn_hr_core_task" table instead of the "sn_hr_core_template"?
I'm asking because "sn_hr_core_template" records don't have the "task_type" property OOTB.
If you're trying to target "task_type" as a field defined in the template under "template" that might prove difficult to achieve due to the way the field is configured.
Hope this helps!
Tudor
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-30-2022 03:45 PM
Thanks for the response Tudor.
Ok I see what you mean. However it is definitely sn_hr_core_template/sys_template table I need to query. See an example below of fields I am wanting to query.
When I run it in the list view it returns the records fine. Is there some dot walking required to get there?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-30-2022 04:52 PM
Hi Mike,
There's an error in addEncodedQuery string. What is the following query suppose to filter?
Is the query suppose to filter on template does not contain "hr_task_type=mark_when_complete"?
templateNOT LIKEhr_task_type=mark_when_complete
The screenshots are querying on "sys_template" table with filter condition "Short description", "starts with", "check for". There's no "hr_task_type" field in the screenshot.
Try setting a filter on the table and then right click on the filter and select "Copy query" and the paste the query to .addEncodedQuery() statement.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-30-2022 04:56 PM
Hi Hitoshi
Sorry I was just showing another example to show the list and form I am trying to query. sn_hr_core_template is extended from sys_template.
Refer to my original post for the actual query I am using
Thanks
Mike