@PhilipI3
To achieve the requirement of creating a new case in a new browser tab upon clicking a button in Pega, you can follow these steps:
Create the Button in Your Section:
Add a button in the section where you want the action to be triggered. You can do this in the section rule.
Configure the Button Action:
Configure the button’s action to open a new URL. This URL should point to the creation of a new case in Pega.
JavaScript for Opening New Tab:
Use JavaScript to open the URL in a new tab. This can be achieved by adding a simple JavaScript function.
Here’s a detailed step-by-step process:
Step 1: Add the Button
Open the section rule where you want to add the button.
Drag and drop a button control onto the section.
Set the button’s properties (label, style, etc.).
Step 2: Configure Button Actions
In the button’s actions tab, add a new action.
Select “Run Script” as the action type.
Step 3: Add JavaScript to Open a New Tab
Define a JavaScript function that opens a new tab with the required URL.
Use the URL format for creating a new case in Pega.
Here’s an example JavaScript function:
javascript code:
function openNewCaseInNewTab() {
var caseType = “Work-Cover-MyCaseType”; // Replace with your case type
var createWorkURL = pega.u.d.createWorkURL({classID: caseType});
// Open the URL in a new tab
window.open(createWorkURL, ‘_blank’);
}
Step 4: Link JavaScript to the Button
In the Run Script action, set the function name to openNewCaseInNewTab.
Save your section.
Step 5: Ensure the Necessary Privileges
Make sure that the user has the necessary privileges to create a new case and that the URL format for creating a new case is correct.
Example:
Assuming you have a section where the button is added, it might look something like this:
html
<pega:section name="YourSectionName">
<pega:button action="runScript" scriptFunction="openNewCaseInNewTab" label="Create New Case" />
</pega:section>
Final Notes:
Replace Work-Cover-MyCaseType with the actual class of the case you want to create.
Ensure that pega.u.d.createWorkURL is the correct function for your Pega version. You may need to adjust it based on your specific Pega configuration.
By following these steps, you should be able to create a new case in a new browser tab when the button is clicked in Pega.