Testing fetchByKey

Welcome back, @claudia_giannoni!

Does your Asset template include a Contract Key in its definition? Knowing that and how it is defined will help us answer your question. If not, try adding a key to the Asset template as described here and let us know how it goes.

Also, keep in mind that keys are not required to fetch contracts. You can reference contracts either by key or ContractId, as explained in that referenced page. The approach you use depends on your workflow.


By the way, thanks for pasting your code into code blocks with the three backticks. You may notice it did not get formatted exactly right. If you place the three backticks on a line all by themselves I think you will get better formatting. (You could even edit your original post to clean it up.)