Expand my Community achievements bar.

For those trying to clean up their templates, I have some goodies for you.

Avatar

Community Advisor

The following filters are for a template report. They should help you see which templates are being used, or not. How often, or not. And when.

Associated CUR PLN ONH projects (projects made from these templates are in progress)

EXISTS:a:$$EXISTSMOD=EXISTS
EXISTS:a:$$OBJCODE=PROJ
EXISTS:a:statusEquatesWith=CUR	PLN	ONH
EXISTS:a:statusEquatesWith_Mod=in
EXISTS:a:templateID=FIELD:ID
isActive=true
isActive_Mod=eq


Associated Projects in Past year (these templates got used this year)

EXISTS:a:$$EXISTSMOD=EXISTS
EXISTS:a:$$OBJCODE=PROJ
EXISTS:a:entryDate=$$NOW-1y
EXISTS:a:entryDate_Mod=gte
EXISTS:a:templateID=FIELD:ID
isActive=true
isActive_Mod=eq


Associated Projects (these templates got used at some point)

EXISTS:a:$$EXISTSMOD=EXISTS
EXISTS:a:$$OBJCODE=PROJ
EXISTS:a:templateID=FIELD:ID
isActive=true
isActive_Mod=eq


No Associated CUR PLN ONH projects (no projects made from this template are currently open)

EXISTS:a:$$EXISTSMOD=NOTEXISTS
EXISTS:a:$$OBJCODE=PROJ
EXISTS:a:statusEquatesWith=CUR	PLN	ONH
EXISTS:a:statusEquatesWith_Mod=in
EXISTS:a:templateID=FIELD:ID
isActive=true
isActive_Mod=eq


No Associated Projects in Past year (this template hasn't been used in a year)

EXISTS:a:$$EXISTSMOD=NOTEXISTS
EXISTS:a:$$OBJCODE=PROJ
EXISTS:a:entryDate=$$NOW-1y
EXISTS:a:entryDate_Mod=gte
EXISTS:a:templateID=FIELD:ID
isActive=true
isActive_Mod=eq


No Associated Projects (this template has never been used)

EXISTS:a:$$EXISTSMOD=NOTEXISTS
EXISTS:a:$$OBJCODE=PROJ
EXISTS:a:templateID=FIELD:ID
isActive=true
isActive_Mod=eq
18 Replies

Avatar

Community Advisor

This is awesome!!! I haven't tried any of these yet but do you know if these will show templates that are attached second and beyond to a project (if you're doing a modular/add-on process) or only templates used to initially create projects?

Avatar

Community Advisor

Hi Monique,

 

Unfortunately, WF does not consider a secondary or sub-template on the project level, only the task level. These filters only consider projects. If you create or attach a template to a project and then look at the template in the overview, it will display that template. If you then attach a second template, that template will not be associated at the project level. I guess that keeps templates from being collections, which has its own set of limitations.

If you add a "Template" column to the tasks list for the project, it will show you which tasks came from which template. here is the code for a template column at the task level:

displayname=Template
linkedname=templateTask
namekey=view.relatedcolumn
namekeyargkey.0=templateTask
namekeyargkey.1=name
querysort=templateTask:template::name
styledef.case.0.comparison.icon=false
styledef.case.0.comparison.leftmethod=percentComplete
styledef.case.0.comparison.lefttext=percentComplete
styledef.case.0.comparison.operator=lte
styledef.case.0.comparison.operatortype=double
styledef.case.0.comparison.righttext=100
styledef.case.0.comparison.trueproperty.0.name=textcolor
styledef.case.0.comparison.trueproperty.0.value=b8b8b8
styledef.case.0.comparison.truetext=
textmode=true
valuefield=templateTask:template:name
valueformat=HTML

 

What you could do (if you really wanted to) is to change the EXISTS statement to filter for tasks, not projects. It would have to cycle through each task so it wouldn't be very efficient, if it worked at all (and I'm not sure it would). Maybe @Doug_Den_Hoed__AtAppStore  has an opinion on if that would work!

Avatar

Community Advisor

Thanks Randy. I was "leading the class" with that question as this came up earlier this week in one of the CS@Scale events around templates and wanted to make sure everyone else understood this fully.

I appreciate you adding the template task column text mode, I feel this will be really helpful for a lot of folx, myself included!

Avatar

Community Advisor

in theory (so... for a very specific use case where all your templates have tasks) if you run a template task report (group by template name) and look for template tasks that don't exist on any project, then you'll maybe be able to achieve two things.

 

1) if there's just one/multiple tasks being 100% deleted, you'll find these and can do partial deletes.

2) IF an entire template's tasks are not being used anywhere then it's possible with the template task report + exists filter, that it's not even a secondary template.

 

just a thought.

 

--------------------------------

If you liked my post, please like my ideas at
https://experienceleaguecommunities.adobe.com/t5n/user/viewprofilepage/user-id/17528599/contribution...

--------------------------------

Avatar

Community Advisor

I love this idea, Skye!

If you have a template with no tasks, we could make an EXISTS reports to list them specifically and then determine if they serve a purpose (is there a unique form, does it contain a request queue, etc)

Avatar

Level 3

Yes! Love the clean-up topics.
My first use of text-mode as well, thank you @RandyRoberts 

No Associated Projects filter returned 122 templates....oh my.

 

Avatar

Level 9

This is making so many dreams come true!

I could use some help with at least one of these filters, though. I tried the Associated CUR PLN ONH projects and received zero hits until I adjusted the line statusEquatesWith down to just one status (ex. CUR). How do I get the filter to accommodate "or" logic to capture all three?

Avatar

Community Advisor

try making sure it's a tab between the statuses, not a space. It looks like copying it to the forum changed all the tabs to spaces.

Avatar

Community Advisor

Great, but that does not bode well for sharing code on these forums!

 

tagging @jon_chen here so he's aware of the issue.

Avatar

Administrator

Hey @RandyRoberts 

 

Thanks for the callout. I will check on this, but I do not think the Community platform's text editor supports tabs. One partial workaround I was able to find was to use the code sample function, which will allow you use copy paste tabs into your response (see example below). You can access the code sample function by selecting the "</>" button in the text editor. However, it doesn't look like you can input tabs into the code sample, you can only copy paste it. 

 

EXISTS:a:statusEquatesWith=CUR	PLN	ONH

 

Avatar

Community Advisor

Thanks Jon, it looks like yours worked. Although in the original post, I used the code sample function and it changed my tabs to spaces. maybe it was broke then it's fixed now?

Avatar

Level 10

These are awesome! Thanks for sharing with us all! 

Avatar

Level 7

you l know what I love about threads like this? Learning! I feel like every time I study exists statements and other text mode, it helps me gain a better understanding of how it all works...  which gives me ideas of other things to try! Thanks for sharing so much detail to help us all learn  

Avatar

Level 3

Ok, this is absolutely AMAZING! Thank you so much for sharing. I still don't have the hang of using EXISTS, so these snippets will really come in handy!

Avatar

Level 2

I was looking at this thread and was wondering what happened to the original solution. I'm definitely still in need of something like this!

 

Thanks!