This article discusses the use of the workflow manager instead of using a user event script to redirect to a Suitelet.
1. Create a test Suitelet. Go to Customization > Scripting > Scripts > New > Suitelet
- Name = Suitelet HTML 1
- Upload on Script File the JS code you have created
- Function = sampleHTML // This is the function name you have assigned for the Suitelet
Here is a sample test HTML Suitelet:
function sampleHTML(request, response)
{
var html;
if(request.getMethod() == 'GET')
{
html = '<html><body><form method="post">';
html = html + '<p>Enter a value and hit submit:<input type="text" name="submitvalue" size="50" maxlength="50"/></p>';
html = html + '<p><input type="submit" value="Submit" /></p>';
html = html + '</form></body></html>';
}
else
{
html = '<html><body>' + request.getParameter('submitvalue');
html = html + '</body></html>';
}
response.write(html);
}
2. Save and deploy the Suitelet by clicking the Save and Deploy button.
- Title = Suitelet // Note the Suitelet title as this will be used on the workflow manager later
- Status = Released
- Save
3. Create a new workflow by navigating to Customization > Workflow > Workflows > New.
4. Define the workflow
a. Name = Redirect to Suitelet
b. Record Type = Transaction
c. Sub Types = Invoice
d. Release Status = Released
e. On Update = True
f. Trigger Type = Before Record Load
g. Click Save.
5. To add a workflow state, click New State and set Name = Go To Suitelet, then hit Save.
6. Click on the Button state and click New Action.
a. Select Add Button.
b. Trigger On = Before Record Load
c. Label = Go To Suitelet
d. Save
7. Click New State and set Name = Load Suitelet, then hit Save.
8. Click on the Load Suitelet state and click New Action.
a. Select Go To Page.
b. Trigger On = Entry
c. Page = Suitelet //this is the deployment name you have indicated on step 2.
d. Save
9. Create a new transaction. Select the Go To Suitelet state first. Click the New Transition button and then select the Load Suitelet state. On the transition, set the following:
- Button = Go To Suitelet
- Save
No comments:
Post a Comment