When changing the state of a document, it is sometimes necessary to fill in a variable using only part of a value of another variable.

For example, the service code of a document validated for production may correspond to the first characters of the Article Code.


 


The tool TaskActions allows to automatically value a variable value when a state change occurs.


To automatically value this variable, a new PDM task must be created.


 



We will name this task Service Code and we will select the myPDMtools add-on:


 


Then you have to select the machine that will execute the task:


 


The tool to use is TaskActions :


 


We will add a TaskProperties operation:


 


In the window that appears, we will drag a custom field :


 


Then, we will fill in the name of the variable to be valued:


 




We will now fill in the value of the variable, so we must click on


Then fill in the variable to be recovered:


 


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



In our case, we want to retrieve the characters before the - character.

We will therefore select Cutting with the character and the index 1 which corresponds to the first occurrence of the string cut by a -


 


TaskActions will automatically manage the extraction and archiving of documents:


 



You just have to validate the creation of the task.

Then add the action to be executed during the transition:


 



Thus, the Service Code will be automatically valued during the validation of the document: