Restricting PDM Template to Certain Folders

Discuss SolidWorks PDM
User avatar
JSculley
Posts: 646
Joined: Tue May 04, 2021 7:28 am
Answers: 55
x 9
x 878

Restricting PDM Template to Certain Folders

Unread post by JSculley »

I think I know the answer to this question, but I'm going to ask anyway. I would like to use a PDM template to create a file, but I only want to be able to run the template from folders with a certain name.

We use project folders for in-process work. Each project folder is created via a PDM template, and that works fine. The project folders contain a series of standard subfolders, one of which is named 'Electrical WIP'. I would like to have a PDM template that is only visible when the user right clicks inside the 'Electrical WIP' folder, because the template will create a file that should only ever exist in a folder named 'Electrical WIP'.

I don't see a way to do this, but I would be happy to discover that I am incorrect.
User avatar
AlexB
Posts: 501
Joined: Thu Mar 18, 2021 1:38 pm
Answers: 28
x 269
x 445

Re: Restricting PDM Template to Certain Folders

Unread post by AlexB »

I had to do it in a bit of a convoluted way, but was able to accomplish this for a specific folder.

My Goal: Have users add a file to an ER folder, but only from within the ER folder.

Why: If this was activated outside the ER folder, the folder data card information was not pulled through to the added file.

How: On my template card, I know that my ER folder will always have an ER number on it. I added control logic to all the controls to hide when the ER Number is blank (this means the user is not in the right folder when they ran the task). I also added one text block that shows when the ER number is blank "cannot be run outside the ER folder" to let the user know what to do to correctly run the template.

Now, since I can't actually hide the template option, it's still available through the full vault. I have the template running as a specific user that has very strict permission for file creation and no permissions for folder creation. If they try and create something outside of their permitted folder, they will get an error. So, if the user opens selects the task and selects OK, it technically submits the data card with all blank variables and they get the following error when the folder/file path doesn't make sense.
image.png
image.png (4.07 KiB) Viewed 1577 times
Card shown when in wrong folder:
image.png
image.png (8.32 KiB) Viewed 1577 times


Same Card shown when in right folder:
image.png
image.png (10.52 KiB) Viewed 1577 times

It sure would be nice to tie this to folder specific permissions like Copy Tree and Branch...


Edit: For your situation, when you add your project folder structure, you can edit the template to apply "file add" permission to the user whose rights/permissions that you are using to run your template. This way, it will compliment your file add task you're looking to complete.
User avatar
AlexB
Posts: 501
Joined: Thu Mar 18, 2021 1:38 pm
Answers: 28
x 269
x 445

Re: Restricting PDM Template to Certain Folders

Unread post by AlexB »

@JSculley, just curious if you were able to get this to work and if so, what your solution was.
User avatar
JSculley
Posts: 646
Joined: Tue May 04, 2021 7:28 am
Answers: 55
x 9
x 878

Re: Restricting PDM Template to Certain Folders

Unread post by JSculley »

For simplicity's sake, I'll probably implement this as a PDM add-in. They give you much more control with much less hoop-jumping.
Post Reply