Is there a way to trigger an interaction on anything but a template field in a table?

As per title. {need more text here to accept body :joy:}

The only way outside of a template field that I know of would be a button field.

In a template I usually do this:

Link to run an action sequence In a Template and pass variables:

<a style="cursor:pointer;" onclick="javascript:skuid.actionSequences.getByName('OurActionSequenceName').run({'RequestID':'{{{Id}}}'});"> (edit)</a>

Items within the action sequence can now use {{$Input.RequestID}} to refer to the passed request id

In V2, you can currently add Interactions to a Template on a Table similar to how you would add Interactions on a Wrapper, so you no longer need the <a> tag.

Pat, what’s your use case for needing to do it outside of a template?

HI Matt,

Templates anywhere can do interactions. Why not fields? It has all the same context available as a template.

Is there any XML back door hackery that I can do that isn’t supported but I want to do anyway. :smiley:

Thanks,

Pat

Doesn’t seem to work for me.

Uncaught TypeError: Cannot read properties of undefined (reading ‘getByName’)

That’s distressing, it sounds like there are some javascript functions that are no longer supported in V2 then. That’s concerning that the javascript V2 api doesn’t support V1 calls.

The V2 API does support actionSequences.getByName(), but V2 also sandboxes pages to avoid conflicting resource names (ex having a model called Contacts on an Account Page, where you can open an include on Opportunities with another model called Contacts). This changed how you would call the action in V1 compared to V2. However, in this case you don’t even need to use it at all since you just click Add Interaction → Add Action and just select the action sequence to run.

I can’t speak to any XML trickery, but if we have a use case I get to make a note to the feature request with an example of how it provides value, which helps out.

1 Like

Interesting. What is the new V2 way to access items on the page via javascript? Do you need to prepend/append the name with the pagename or something like that? Is there a guide that outlines this that I can refer to?

Edit: nevermind, I just noticed the blue text…

so it would be like this then?

skuid.runtime.getPage('MyPageName').actionSequences.getByName('OurActionSequenceName').run({'RequestID':'{{{Id}}}'});

Actually there is one type of template that doesn’ allow for interactions. The child relationship field. I often use to provide a short high level view of child records of a parent record in table component.

I’ve had a similar use case with child relationships in tables, the code I posted is what I used in that instance to allow for an action on a child object in a table. I guess the revised code I posted is how you would go about it on V2 pages.

Correct, the way to call it from from a template as you had it. But it’s worth noting that you will have access to skuid.actionSequences.getByName() if you’re trying to call it in a custom renderer, javascript snippet, custom formulas, custom components, etc. These areas have the page in context, so skuid behaves similar to how you’d expect in V1.

1 Like

I’m getting the action sequence to trigger but the input value isn’t being used.

onclick="javascript:skuid.runtime.getPage('ProductionSetup').actionSequences.getByName('PT Workflows').run({'ptId':'{{{Id}}}'});"

That’s interesting, I hadn’t noticed this before - you can’t if you drag and drop the child relationship onto the table. But you can if you add a template then use {{#Opportunities.records}}{{Name}} ({{Amount}} Stage: {{StageName}}, Close: {{CloseDate}})<br>{{/Opportunities.records}} style merge. I think that’s a issue, so I’m going to go ahead and enter a ticket for that and link it back to this discussion.

That worked. Adding child fields in the field selector should be an option instead of having to know the syntax to get to children, which isn’t officially documented that I know of.

1 Like

It’s documented here since it’s the looping over arrays merge, but for child relationships it is much easier to build use the nice selector.

image