Hi, I'm Michal Liu, a developer on PLM 360. I will be showing you how to get the most out of PLM scripting.
As this is my first post, I am going to walk through the process to create and run a simple script code. In future posts, I will dive into some topics like script types, triggers, script chain, programming tabs and so on. For now, let's just build a "hello world" code.
- You need to be logged in as an administrator, otherwise you won't be able to create scripts.
- Make sure you have a workspace W having a "Single Line Text" field named "Title".
- You also need "Edit Items" permission for workspace W.
Step 1: Write some code
To create a script code, you need go to Administration -> System Configuration -> Scripting -> click "New Script" button on the top left of the page.
- Leave "Script Type" as default type "Action".
- Give it a "Unique Name". e.g. myActionScript. (The unique name must be between 3 and 50 characters.)
- You can leave the "Description", "Imports" and "Enable Code Complete" as they are for now.
- Put the below text into "Code" and click Save button.
item.TITLE = "Hello World";
Step 2: Configure the script into workspace W
Go to Administration -> Workspace Manager -> W -> Behaviors. Select "myActionScript" for "Script to run on demand". After the selection, another row of "Script to run on demand" pops up. It's okay. Click Save.
Step 3: Run the script
Go to an item's page from workspace W. Click the script icon; click Confirm in the popped up dialog.