RedirectToCase()
A RedirectToCase() function will redirect a user to a specified case form that will be open in a specified target (i.e. a new, current window/tab or a popup window). Optional confirmation prompt and message can be specified.
Syntax
RedirectToCase(caseId,target);
RedirectToCase(caseId,target,ask);
RedirectToCase(caseId,target,ask,confirmText);
RedirectToCase(caseId,target,ask,confirmText,urlparams);
Function arguments
- caseId – (Decimal) an ID of the case to be redirected to;
- target – (String) a redirection target tab/window, this parameter can have values 'current’, 'new’ or 'popup’;
- ask – (Boolean) [Optional] ask user if he/she wants to be redirected (default = false);
- confirmText – (String) [Optional] an optional text for the redirection prompt. Only valid with the 'ask’ parameter set to 'true’. If not used, default prompt text is used;
- urlparams – (String) [Optional] additional parameters that will be add to the url of the case page, ex.: tab=1&repName=Report.
Return value
This function returns String.
The RedirectToCase() function always returns an empty string.
Examples
Example 1
This will redirect the user to the specified case form that will be open in a new window/tab.
c = CopyCase(); RedirectToCase(c,"new");
Example 2
This will ask the user with a standard question if he/she wants to be redirected to the specified case form that will be open in current window/tab.
c = CopyCase(); RedirectToCase(c,"current",true);
Example 3
This will ask the user with a specified question if he/she wants to be redirected to the specified case form that will be open in current window/tab.
c = CopyCase(); RedirectToCase(c,"current",true, "Are you sure?");
Example 4
This will create a new case and redirect the user to this case form in a new window/tab. The window/tab will be open with a tab param which means that the window/tab will be closed when the user leaves the case. A repName parameter contains name of the report field on the source case that will be refreshed when user closes the case.
c = CreateCase("Invoice","Start"); RedirectToCase(c,"new",false,"","tab=1&repName=Invoices");
Example 5
This will open a case selected in the „Client” reference field in a popup window.
RedirectToCase([Client],"popup");