Saturday, July 14, 2018

Create a Submit to Workflow Class

To submit a document for workflow processing, call standard code to prompt the
user for a comment and to process the submission. Perform the following steps to
create a submit to workflow class.


1. Press
Ctrl+Shift+P to open the development projects window.

2. Expand Private.


3. Double
-click on SalesCreditLimitApprWFType developement project.

4. In the development project find the class 
SalesCreditLimitApprSubmitManager.
5. Create a new method called submit, and copy the following code for this method.

6. Modify the code for the
main method as shown in the following code.

7. Press
F8 to save and compile the code.

8. Find the menu item
SalesCreditLimitApprSubmitMenuItem.

9. Change the Label property to Submit.

10. Right
-click on the SalesCreditLimitApprSubmitMenuItem menu item and select Save. 


 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
void submit(Args args)
{
// Variable declaration.
recId recId = args.record().RecId;
WorkflowCorrelationId workflowCorrelationId;
// Hardcoded type name
WorkflowTypeName workflowTypeName =
workflowtypestr(SalesCreditLimitAppr);
// Initial note is the information that users enter
when they
// submit the document for workflow.
WorkflowComment note ="";
WorkflowSubmitDialog workflowSubmitDialog;
SalesTable SalesTable;
// Opens the submit to workflow dialog.
workflowSubmitDialog =
WorkflowSubmitDialog::construct(args.caller().getActiveWork
flowConfiguration());
workflowSubmitDialog.run();
if (workflowSubmitDialog.parmIsClosedOK())
{
recId = args.record().RecId;
SalesTable = args.record();
// Get comments from the submit to workflow dialog.
note = workflowSubmitDialog.parmWorkflowComment();
try
{
ttsbegin;
workflowCorrelationId =
Workflow::activateFromWorkflowType(workflowTypeName,
recId,
note,
NoYes::No);
SalesTable.CreditLimitApprovalStatus =
SalesCreditLimitApprovalStatus::Submitted;
// Send an Infolog message.
info("Submitted to workflow.");
ttscommit;
}
catch(exception::Error)
{
info("Error on workflow activation.");
}
}
args.caller().updateWorkFlowControls();
}

Best Regards,
Hossein Karimi

No comments:

Post a Comment

Configure the Firewall on the Enterprise Portal Server

After you install Enterprise Portal, enable Web Server (HTTP) in Windows Firewall. If you do not enable the web server in Windows Firewall...