What's the best way to force the Invoice list page...
# suitecommerce
c
What's the best way to force the Invoice list page to be the homepage on SCMA? I want to avoid another extension if possible and redirects don't seem to work. The redirect below causes too many redirects in the browser - must be something to do with SCAs weird URLs.
s
Since the redirect is pointing to itself, it’s expected to fall into a loop, because redirects don’t work for “fragments” in SCMA... In our experience, we’ve only solved this in the past for other clients with a custom extension that essentially performs a redirect to the specific fragment you need
c
I’m creating an extension right now for that purpose.
I came to the same conclusion - because the SSP reads the # I need to somehow intercept the route… or something like that
s
Yes, that's right! 👌
c
@Sofia Ageitos would you mind sharing your approach? I've tried this but I'm not having much luck. https://docs.oracle.com/en/cloud/saas/netsuite/ns-online-help/section_164461485991.html#Redirect-a-User-Back-to-their-Current-Page
e
@Craig run your extension on my account if you do not have any fragment or route on your current url like #purchases , #returns, etc, I would do a simple window.location.href = invoice list page. You might need to do extra things if you only want to load this after logging in but in general that should work.
c
I've tried so many ways in the past day.
I couldn't crack it.
I then thought I would just put the balance (or invoices) tpl contents into the account overview but obviously the data isn't available to the UI at that point.
e
I have not worked so far with SCMA, that might be a little different, I guess but on your mountToApp, try adding a setTimeOut of some seconds to then perform your window.location.href, at the beginning my account is still loading and checking stuff, probably you need to find the right event, you can also try afterViewRender or events from https://developers.suitecommerce.com/events.html
Copy code
var self = this;
Backbone.history.on('route', function () {
    // Log where the user is
    console.log('New user location:', Backbone.history.location.hash);

    // Or perhaps you want to re-render self
    self.render()
})
This example is from the link I share and it looks like it could work for you, put inside the window.location.href. Last resource is that you add a child view on the home page and you call the native service for invoices to render the data in that way, you are getting the data and once the service is done, you can render the data. You are not re-inventing the wheel but adding some extra steps.
c
@eminero Thanks for this - I'm going to try a few things here and try to get it working.