Saving query data in variable after additional scope

I am writing a JS query that will return markdown for a PDF I need to create. Part of it involves triggering an existing query with a parameter and I'm using Additional Scope. I need to save the new query data after it's been triggered by can't for the life of me get it right. Here's what I have:

const data = Line_Items_For_PDF.trigger({additionalScope: {ticket_id: ticketId,}});

Any help would be greatly appreciated.

Hi @Nick01,

I also had a difficult time getting additionalScope working. Another option is to save the parameters in Temporary State variables and then reference those variables in you query.


1 Like

Hi @Nick01

Should be as simple as passing the data back to an 'onSuccess' Function like so:



1 Like

You can also use await! The following should do the trick:

const data = await Line_Items_For_PDF.trigger({additionalScope: {ticket_id: ticketId,}});

Calling trigger on a query in JS returns a Promise that resolves to the query data.

1 Like

@Kabirdas -

I always forget about that....thanks!

Thanks everyone! I think I got it.