Workflow script / Filter items, check workflow state, make an email

Workflow script / Filter items, check workflow state, make an email

carsten_maaß
Participant Participant
839 Views
3 Replies
Message 1 of 4

Workflow script / Filter items, check workflow state, make an email

carsten_maaß
Participant
Participant

Hi Community,

i need some help by scripting a workflow-script.

 

If someone changes Workflow State of an item i want to check if there are more Items with same "Auftragsnummer" (order number) and with same workflow-current state called "ready". And if they are all on this special Workflowstate called "ready" i want to make an email to a group of user with all items in it. If not, i want to do nothing until it happens.

 

See my screenshot.

 

Maybe someone can give me a few hints how to do it.  

 

BR Carsten

0 Likes
840 Views
3 Replies
Replies (3)
Message 2 of 4

sven.dickmans
Autodesk
Autodesk

Can you please describe your schema (what workspaces are involved how are they related/connected)?

Are all the items with same order number related to a common 'parent' object like the order? If so, your use case can be implemented. If these items are NOT connected to a common object (neither through relationships, pick list, BOMs etc), you would have to perform a query in the system to find items with the same order number. In this case, scripting will not be of help as you cannot perform the required query by script.

I would recommend managing the 'order' as dedicated object in PLM and let users connect the items of this order to the order by using a pick list. With this, the items can inherit the order number and implementation of your mail will be easy.

 

Message 3 of 4

carsten_maaß
Participant
Participant

Hi,

thanks so far. All items are in same Workspace but they don´t have an 'parent' object yet. They only have a textfield called "Auftragsnummer" thats all. What means "dedicated object in PLM"? Can it be done by "on create" or "on edit" of an item. Or does it need to be done by hand/user?

 

Idea 1

I need to add an Workspace called "Auftragsnummern (order no.)" and use this as a picklist in my other workspace? Or it´s possible by "on create" to add this ordernumber into another workspace and make an relationship to it? And if its allready added just make an relationship for next elements?

 

Idea 2

What means "cant be dont by script" which other way i could take?

 

Thank you very much for your time!

0 Likes
Message 4 of 4

sven.dickmans
Autodesk
Autodesk

Let me explain the idea by reusing an example that you can find in the standard Items and BOMs workspaces of PLM. These items have a field 'Manufacturer' which enables to select an existing manufacturer from the library. In addition, users can click the blue plus icon to create a new manufacturer record if the desired manufacturer is not listed.

 

Linking Pick List.png

 

You could apply this mechanism to your use case as well: Create a new workspace Auftragsnummern (even if this workspace may include a single field like the Auftragsnummer only). Next, in your items workspace, create a Linking Pick List field that is linked to this new workspace. Set this field to be mandatory. With this setup, users can then either select an Auftragsnummer that exists already or they can store / create a new number when needed. All this is achieved without scripting. 

 

This not only makes it easier for users to choose the right Auftragsnummer without retyping the same number over and over again, it also addresses your initial requirement for the automatic notification. As the items now all can be connected to the same object (the Auftragsnummer record) by script, you can retrieve all related items by script and send the summary mail.

 

It might be best to reach out to your implementation partner to review your set up and to help you in setting up both the workspaces and the scripts.

0 Likes