Steps_Common

Properties#

Variables#

Functions#

fieldsstring[]
The fields to retrieve in the records.
fieldsstring[]
The fields to retrieve in the records.
fieldsstring[]
The fields to retrieve in the records.
entry_pointstring
The name of the data model to retrieve its records.
servicestring
The name of the module's service.
optionsRemoteJoinerOptionsOptional
variablesRecord<string, any>Optional
Filters, context variables, or pagination fields to apply when retrieving the records.
variablesRecord<string, any>Optional
Filters, context variables, or pagination fields to apply when retrieving the records.
variablesRecord<string, any>Optional
Filters, context variables, or pagination fields to apply when retrieving the records.
throw_if_key_not_foundbooleanOptional
Throw an error if a record isn't found matching an ID specified in the filters.
throw_if_key_not_foundbooleanOptional
Throw an error if a record isn't found matching an ID specified in the filters.
throw_if_key_not_foundbooleanOptional
Throw an error if a record isn't found matching an ID specified in the filters.
throw_if_relation_not_foundboolean | string[]Optional
Throw an error if a specified relation isn't found.
throw_if_relation_not_foundboolean | string[]Optional
Throw an error if a specified relation isn't found.
throw_if_relation_not_foundboolean | string[]Optional
Throw an error if a specified relation isn't found.
listbooleanOptional
Whether to retrieve the records as an array. If disabled, only one record is retrieved as an object.

Default: true

listbooleanOptional
Whether to retrieve the records as an array. If disabled, only one record is retrieved as an object.

Default: true

listbooleanOptional
Whether to retrieve the records as an array. If disabled, only one record is retrieved as an object.

Default: true


createLinksStepId#

Const createLinksStepId: "create-remote-links"


dismissRemoteLinkStepId#

Const dismissRemoteLinkStepId: "dismiss-remote-links"


emitEventStepId#

Const emitEventStepId: "emit-event-step"


removeRemoteLinkStepId#

Const removeRemoteLinkStepId: "remove-remote-links"


updateRemoteLinksStepId#

Const updateRemoteLinksStepId: "update-remote-links-step"


useRemoteQueryStepId#

Const useRemoteQueryStepId: "use-remote-query"


createRemoteLinkStep#

This step creates remote links between two records of linked data models.

Learn more in the Remote Link documentation..

Example#

Code
1import { createWorkflow } from "@medusajs/framework/workflows-sdk"2import { createRemoteLinkStep } from "@medusajs/medusa/core-flows"3import { Modules } from "@medusajs/framework/utils"4
5const helloWorldWorkflow = createWorkflow("hello-world", () => {6  createRemoteLinkStep([7    {8      [Modules.PRODUCT]: {9        product_id: "prod_123",10      },11      helloModuleService: {12        my_custom_id: "mc_123",13      },14    },15  ])16})

Input#

LinkDefinition[]LinkDefinition[]

Output#

LinkDefinition[]LinkDefinition[]

dismissRemoteLinkStep#

This step removes remote links between two records of linked data models.

Learn more in the Remote Link documentation..

Example#

Code
1import {2  createWorkflow3} from "@medusajs/framework/workflows-sdk"4import {5  dismissRemoteLinkStep6} from "@medusajs/medusa/core-flows"7import {8  Modules9} from "@medusajs/framework/utils"10
11const helloWorldWorkflow = createWorkflow(12  "hello-world",13  () => {14    dismissRemoteLinkStep([{15      [Modules.PRODUCT]: {16        product_id: "prod_123",17      },18      "helloModuleService": {19        my_custom_id: "mc_123",20      },21    }])22  }23)

Input#

DismissRemoteLinksStepInputDismissRemoteLinksStepInput

Output#

LinkDefinition[]LinkDefinition[]

emitEventStep#

Emit an event.

Example#

Code
1import {2  createWorkflow3} from "@medusajs/framework/workflows-sdk"4import {5  emitEventStep6} from "@medusajs/medusa/core-flows"7
8const helloWorldWorkflow = createWorkflow(9  "hello-world",10  () => {11    emitEventStep({12      eventName: "custom.created",13      data: {14        id: "123"15      }16    })17  }18)

Input#

InputInput

removeRemoteLinkStep#

This step deletes linked records of a record.

Learn more in the Remote Link documentation

Example#

Code
1import {2  createWorkflow3} from "@medusajs/framework/workflows-sdk"4import {5  removeRemoteLinkStep6} from "@medusajs/medusa/core-flows"7import {8  Modules9} from "@medusajs/framework/utils"10
11const helloWorldWorkflow = createWorkflow(12  "hello-world",13  () => {14    removeRemoteLinkStep([{15      [Modules.PRODUCT]: {16        product_id: "prod_123",17      },18    }])19  }20)

Input#

RemoveRemoteLinksStepInputRemoveRemoteLinksStepInput

Output#

DeleteEntityInputDeleteEntityInput

updateRemoteLinksStep#

Input#

LinkDefinition[]LinkDefinition[]

Output#

LinkDefinition[]LinkDefinition[]

useQueryGraphStep#

Type Parameters#

TEntrystringOptional

Parameters#

Returns#

dataTEntry extends never ? RemoteQueryEntryPoints[TEntry<TEntry>][] : any[] | WorkflowData<TEntry extends never ? RemoteQueryEntryPoints[TEntry<TEntry>][] : any[]>
GraphResultSetGraphResultSet<TEntry>
WorkflowDataPropertiesWorkflowDataProperties<GraphResultSet<TEntry>>
config(config: { name?: string } & Omit<TransactionStepsDefinition, "next" | "uuid" | "action">) => WorkflowData<GraphResultSet<TEntry>>
StepFunctionReturnConfigStepFunctionReturnConfig<GraphResultSet<TEntry>>

useRemoteQueryStep#

This step fetches data across modules using the remote query.

Learn more in the Remote Query documentation.

Example#

To retrieve a list of records of a data model:

Code
1import {2  createWorkflow3} from "@medusajs/framework/workflows-sdk"4import {5  useRemoteQueryStep6} from "@medusajs/medusa/core-flows"7
8const helloWorldWorkflow = createWorkflow(9  "hello-world",10  () => {11    const products = useRemoteQueryStep({12      entry_point: "product",13      fields: [14        "*",15        "variants.*"16      ]17    })18  }19)

To retrieve a single item instead of a an array:

Code
1import {2  createWorkflow3} from "@medusajs/framework/workflows-sdk"4import {5  useRemoteQueryStep6} from "@medusajs/core-flows"7
8const helloWorldWorkflow = createWorkflow(9  "hello-world",10  () => {11    const product = useRemoteQueryStep({12      entry_point: "product",13      fields: [14        "*",15        "variants.*"16      ],17      variables: {18        filters: {19          id: "123"20        }21      },22      list: false23    })24  }25)

To throw an error if a record isn't found matching the specified ID:

Code
1import {2  createWorkflow3} from "@medusajs/framework/workflows-sdk"4import {5  useRemoteQueryStep6} from "@medusajs/core-flows"7
8const helloWorldWorkflow = createWorkflow(9  "hello-world",10  () => {11    const product = useRemoteQueryStep({12      entry_point: "product",13      fields: [14        "*",15        "variants.*"16      ],17      variables: {18        filters: {19          id: "123"20        }21      },22      list: false,23      throw_if_key_not_found: true24    })25  }26)

Input#

EntryStepInput | ServiceStepInputEntryStepInput | ServiceStepInput
Was this page helpful?
Edit this page