magic-amber
magic-amber16mo ago

How can I get the resource id that I just created?

As the picture, I want to update receiptId in debit_notes after I create a new receipt But I don't know how to get receiptId right after I create a new receipt
No description
6 Replies
kapa.ai
kapa.ai16mo ago
Hi @j7.dev. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:
kapa.ai
kapa.ai16mo ago
---------------------- Hmm, I don't know enough to give you a confident answer yet. However, you can refer to the refine documentation for more information on handling data and actions: https://refine.dev/docs ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ----------------------
Overview | refine
What is refine?
kapa.ai
kapa.ai16mo ago
<@1085258022416285727> kapa.ai is still learning and improving, please let us how it did by reacting below
harsh-harlequin
harsh-harlequin16mo ago
@j7.dev Though i am unsure how the bot exactly works, i think asking it like this might be better! "How can I update the receiptid value in the debit_notes resource with the receiptId value obtained after creating a new receipt?" I believe you would need to have it be async and then have an new and old receiptID or something similar though... but i don't know too much
conscious-sapphire
conscious-sapphire16mo ago
Hey @j7.dev I think you can do this in onSuccess. You can view the details here. https://refine.dev/docs/api-reference/core/hooks/data/useCreate/#mutationoptions
useCreate | refine
useCreate is an extended version of TanStack Query's useMutation. It supports all the features of useMutation and adds some extra features.
magic-amber
magic-amber16mo ago
Thanks, I will try it