How can I design a SuiteScript to run anytime a us...
# ask-stanley-ai
m
How can I design a SuiteScript to run anytime a user attempts to visit the Create Intercompany Journal Entry page, and have them switch over to Advanced Intercompany Journal Entry.
c
AI generated answer (using internal Slack threads):
To design a SuiteScript that runs anytime a user attempts to visit the Create Intercompany Journal Entry page and have them switch over to Advanced Intercompany Journal Entry, you can use a Client Script or User Event Script. Here's a high-level approach: 1. Create a Client Script or User Event Script that is deployed on the Intercompany Journal Entry record type. 2. In the script, use the
beforeLoad
function to check if the context is
CREATE
. 3. If the context is
CREATE
, redirect the user to the Advanced Intercompany Journal Entry page using the
redirect.toTaskLink
method. Here's a pseudo-code example:
Copy code
javascript
/**
 * @NApiVersion 2.x
 * @NScriptType UserEventScript
 */
define(['N/redirect'], function(redirect) {
    function beforeLoad(context) {
        if (context.type === context.UserEventType.CREATE) {
            redirect.toTaskLink({
                id: 'TASKLINK_ID' // replace with the task link id of the Advanced Intercompany Journal Entry page
            });
        }
    }

    return {
        beforeLoad: beforeLoad
    };
});
Please replace
'TASKLINK_ID'
with the actual task link id of the Advanced Intercompany Journal Entry page. You can find this id by navigating to the page and inspecting the URL. ****** Disclaimer: This response was generated by an artificial intelligence assistant based on previous conversations from multiple Slack channels, and may contain inaccuracies or mistakes. ******
Slack thread 1: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.841569066
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.838144064
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.837991
Please provide your feedback on this answer.