Error when trigger triggerSmartAction function in Smart Views

Expected behavior

Trigger triggerSmartAction in Smart Views should work stable and shouldn’t raise any error

Actual behavior

We’re triggering Smart Action in Smart Views. However, instead of triggering Smart Action from .hbs template as Forestadmin document here, we’re triggering Smart Action from javascript file.

The code looks like this:
          "Add Card",
            loanID: loanNumber

This function worked stable until May 25th. Now we usually meet the error when use this function.

Failure Logs

TypeError: i is not a function
    at client-8b5739fb63a9086c512f0346259b057c.js:formatted:9829
    at x (vendor-da149b7b99d0ae9d25e160538c12fc3b.js:formatted:40205)
    at vendor-da149b7b99d0ae9d25e160538c12fc3b.js:formatted:40228
    at t.invokeWithOnError (vendor-da149b7b99d0ae9d25e160538c12fc3b.js:formatted:37213)
    at e.t.flush (vendor-da149b7b99d0ae9d25e160538c12fc3b.js:formatted:37147)
    at e.t.flush (vendor-da149b7b99d0ae9d25e160538c12fc3b.js:formatted:37251)
    at e.r._end (vendor-da149b7b99d0ae9d25e160538c12fc3b.js:formatted:37577)
    at e.r.end (vendor-da149b7b99d0ae9d25e160538c12fc3b.js:formatted:37382)
    at e.r._run (vendor-da149b7b99d0ae9d25e160538c12fc3b.js:formatted:37606)
    at e.r._join (vendor-da149b7b99d0ae9d25e160538c12fc3b.js:formatted:37594)


  • Package Version: forest-express-sequelize 5.7.0
  • Express Version: 4.17.1
  • Sequelize Version: 5.15.2
  • Database Dialect: Postgres (pg) 6.1.0
  • Database Version: (not sure what’s it?)
  • Project Name: scratchpay-payment-service
1 Like

Hi @mr.leo,

When you want to call an action from a template you need to use the Ember way.
You can call it like that:

export default class MyComponent extends Component {
  callFromHere() {
    this.send('triggerSmartAction', this.collection, 'Add card', ...);

The send action allows you to call any action define on the component :wink:

Thanks @vince,

I try with your suggestion but still get the same error. The root cause is the number of parameters of this function triggerSmartAction is 4, but the guideline in your document only has 3 parameters.

If I change to:

this.send("triggerSmartAction", this.collection, "Add Card", data, f => {console.log(f)}

the error will be gone.

What I concern about is that the system which is handling Smart Views is on your side (Forestadmin side). I’m not sure that do you guys have any update in the Smart Views handling system or not. That could be the root cause to break our feature as well. Can you please show me some changelog or history if any?

1 Like

Hey @mr.leo,

you don’t need anymore the callback it has been fixed yesterday. Just so you know :wink:

Have a great day !

1 Like

Thanks @vince,

We still have 2 biggest issues with the Smart View recently:

  1. Trigger Smart Action in Smart View via triggerSmartAction one time that causes a lot of duplication actions with the same event. The consequence is it created many duplication data in the Backend side.
  2. Somehow triggerSmartAction cannot keep payload integrity. It leads to bug in Backend as well.

This function triggerSmartAction worked very well in the past but it’s unstable nowadays. I’m not sure what did you guys change in the Forestadmin side.

Can you show me some history or changelog related to triggerSmartAction or Smart View updates?

It’s a serious problem in our end with more than 30 operation team members. We really need your support here. Thanks

I’ll give a code example that we’re using.

For example, here is our payload and our action in Smart View’s javascript:

export default Component.extend(SmartViewMixin, {
  handleAddingCard(loanNumber) {
    const resultToken = {
      vendor: "payix",
      token: this.newCard.methodToken,
      name: this.newCard.nameOnCard,
      last4: this.newCard.lastFourDigits,
      type: this.newCard.cardBrand,
      billingZip: this.newCard.billingZip

      "Add Card",

When trigger handleAddingCard, it will call /actions/add-card endpoint in routes backend side. Here is our function to listen to this event:"/actions/add-card", async (req, res) => {
  const card =[0];{
    ...lodash.pick(card, [
  // other code here"Add card successfully", { requestID: });
  return res.send({
    success: "Add card successfully. Please refresh to see new update."

However, when I check our logs in server-side, our payload data missed some information, the actual payload was logged:


This issue only happens in Production, not Staging. It’s really hard for us to debug/investigate what’s exactly the root cause here

Okey and when you try to log this line in your smart view just before sending it does it work ? :thinking: Because if it’s a forest model it’s missing the prefix forest-

newCard is our object created in Smart View (not from forest model)

Btw, it turns out that the error from our side. Misconfiguration Smart View between multiple teams. We synchronized and the issue has gone. But it would be nice that you guys could provide any update in Smart View (EmberJS engine) side if any. Right now I don’t find any place has this information.

Thanks for your support