Get content based on a specific field in another schema in scripts


I have 2 below schemas.


  • id
  • name
  • product-id
  • order-product-key


  • id
  • name
  • order-product-id
  • product-key

product-id in schema-a is not a reference field to order-product-id in order and vice versa.

My use case is, on creation of content of schema-a I want to update the order-product-key value with the value of product-key of schema order based on condition where product-id = order-product-id.

So what I am looking for is, how can I search the content of order by order-product-id field in create scripts of schema-a and use the returned order content to update the order-product-key.

Why are you not using references? You can use custom IDs when you create a content item. Therefore you can reuse the IDs from another system and just use normal references.