Auto Set Custom Attribute | ION Factory OS
The manual for the New ION Experience has been released.
For the complete documentation index, see llms.txt. This page is also available as Markdown.
Scenario
Every time a part is created, set the custom attribute Tracking Strategy based on the following table:
| Tracking Level | Sourcing Strategy | Tracking Strategy |
|---|---|---|
| None | Make | N/A |
| None | Buy | N/A |
| Lot | Make | Lot - Make |
| Lot | Buy | Lot - Buy |
| Serial | Make | Serial - Make |
| Serial | Buy | Serial - Buy |
Trigger
The flow should be triggered when a part is created.
Steps
Create a new flow using the ion-webhooks component. Configure the ion-webhooks step by setting the Connection, providing a name for the webhook receiver, and adding an action. In this example we want the flow to be triggered when a part is created so the action will be
Parts - CreateAdd a step that uses the
First Resonance IONcomponent. Click on the+icon at the bottom of the flow then search forFirst Resonance ION. Click onRun GraphQL Query.
Configure the Connection, GraphQL Query, and GraphQL Variables
Use the following query:
query getParts($filters: PartsInputFilters!) {
parts(filters: $filters) {
edges {
node {
id
_etag
partNumber
sourcingStrategy
trackingType
}
}
}
}
Use the following query variables:
{
"filters": {
"id": {
"eq":
}
}
}
Add a reference in the query variable to the incoming id from the webhook trigger
Refer to this for detailed documentation on using the First Resonance ION component.
- Add a step that branches based on the value of the Tracking Level. Search for "branch" and select
If Condition is Met
Configure the branch step to check the Tracking Level:
Click the icon in the first Field and configure the input to the output of the previous step.
Select does not exist for the Operator
- Click on the
+icon in the "Tracking is None" side of the branch. Search for "Execution save value". SelectExecution - Save Value
Enter trackingStrategy for the Key and N/A for the Value
- Click on the
+icon in the "Else" side of the branch. Search for "Execution save value". SelectExecution - Save Value
Enter trackingStrategy for the Key
Enter references to the trackingType and sourcingStrategy for the Value separated by a -
- Add a step at the end of the flow that will return the value of
trackingStrategy. Click on the+icon at the bottom of the flow then search for "Execution get value". Click onExecution - Get Value
Enter in trackingStrategy for the Key
- Add a step to set a custom attribute to the value of
trackingStrategy. Click on the+icon at the bottom of the flow then search for "First Resonance ION". Click onRun GraphQL Query.
Configure the Connection, GraphQL Query, and GraphQL Variables
Use the following query:
mutation UpdatePartAttributes($input: UpdatePartAttributeInput!) {
updatePartAttribute(input: $input) {
partAttribute {
partId
Etag
key
value
}
}
}
Use the following query variables:
{
"input": {
"partId": ,
"key": "",
"value": "",
"etag": ""
}
}
Add a references in the query variable to the partId, etag, and value.
Reference to the partId:
Reference to the etag:
Reference to the value:
The query variables should look like this:
The final flow should resemble this: