Add additionalScope gui input fields in event handlers

This is great post, thanks for it. Just curious if there is any plan to pass additional scope from gui -> control query.
image
That would simplify the process and we won't have to rely on run script everywhere.
Thanks

1 Like

Hey @mpmohi! Thanks for reading and for the kind words :slight_smile:

And actually, I think we may have just pushed this feature (to go live with our next deploy, likely sometime next week) :eyes:

3 Likes

WoW, that would be a very nice feature I am sure many user will appreciate this.

Thanks again for your hard work. keep it up :smiley_cat:

1 Like

HI, is this in roadmap yet?, would be really useful to set additionalScopes in GUI, like a text field to do something like

{scope1: "val1", scope2: "val2"}

+1
This would be usefull

Hi, one problem I was having was that the passed additionalScope key cannot be the same as an existing name of other elements. I have added Param suffix to distinguish it from existing controls and it worked:

JS script:

query.trigger({
    additionalScope: {
      control1Param: ProjectData.data.ProjectID[0],
      control2Param: 'something else',
      createdUserParam: current_user.fullName,
      createdDateParam: moment().utc().format("YYYY-MM-DD hh:mm:ss"),
    },
    onSuccess: (data) => {
      console.log('Success ' + JSON.stringify(data));
    },
    onFailure: (error) => {
      console.log(`Duplication failure: ${error}`)
    })

sql server query:


  EXEC dbo.mystoredprocedure {{ control1Param }}, {{control2Param}}, {{ createdUserParam }}, {{ createdDateParam }};
2 Likes

Anyone know if this feature actually ended up getting deployed in Jul '23 as @victoria noted? It would be extremely helpful for my project. Maybe I'm missing something, but I don't see the feature in my editor

I've noticed it depends on the query type (SQL vs GUI). However, it seems that if you define an additional scope variable in SQL mode and then switch over to GUI mode, the event handler recognizes the additional scope variable.

I haven't tested this at all - so not sure if when you trigger a GUI mode query with the Additional Scope entered in the event handler if will use it. @victoria - do you know if that would be the case?

SQL (can enter Additional Scope variable) vs GUI (no place to enter the variables, but they will be respected if you pass them


vs

Put the variable in the additional scope
image

Note with GUI mode linting suggest the variable is not valid (though it will work)

But here there is a spot for the variable
image

1 Like