AWS Appsync Graphql Get the Newly created item Id

Viewed 133

I'm trying to save a new item to a graphql model, and then get the newly created item id and then use it to save to another table.

Here is the code I'm using for creating the new item

import { DataStore } from "@aws-amplify/datastore";
import { Tenants } from "./models";

DataStore.save(
      new Tenants({
        agency_name: "Lorem ipsum dolor sit amet",
      })
    );

//Now, Here I will do my stuff with the newly created tenant Id.

Thanks a lot

0 Answers
Related