When changing a document's status, it is sometimes necessary to populate a variable using only part of the value of another variable.

For example, the service code of a document approved for manufacturing may correspond to the first characters of the Part Number.


 


The TaskActions tool allows you to automatically assign a value to a variable when a state changes.


To automatically assign a value to this variable, you must create a new PDM task.


 



We'll name this task "Service Code" and select the myPDMtools add-on:


 


Next, select the machine that will run the task:


 


The tool to use is TaskActions:


 


We're going to add a TaskProperties operation:


 


In the window that appears, we'll drag a custom field into it:


 


Next, we'll enter the name of the variable to be assigned a value:


 




We're now going to enter the value for the variable, so click on


Then enter the variable you want to retrieve:


 


To retrieve only a part of the string, just click on



In our case, we want to retrieve the characters that come before the – character

So we'll select "Split by character –" and index 1, which corresponds to the first occurrence of the string separated by a -


 


TaskActions will automatically handle the extraction and archiving of documents:


 



All you have to do is confirm the creation of the task.

Then add the action to be performed during the transition:


 



Thus, the Service Code will be automatically populated when the document is validated: