Activity Process:
Step 1. Add Enum
type for process with "YourProcessName" and "enum value" you will use many placess
1.1).
In HierarchyType Enum add the bellow element with "YourProcessName" and "enum value"
1.2).
In smmActigityParentType Enum add the bellow element with "YourProcessName" and "enum value"
Step 2. Create EDT
To create EDT we cannot
create “Relation Node” EDT Level so just duplicate it
New EDT, here 102 is the
Enum value
Create Field Fix
Relation with Hierarchy table
Step 4. Add code in tables
4.1).
Hierarchy
getMenuItemStr(HierarchyType
_hierarchyType)
// Sales
agreement cancellation process
case
HierarchyType::DNGRSSalesCancellation :
menuItemStr = menuitemDisplayStr(DNGRSSalesCancellationProcess);
break;
hierarchyType2fieldId(HierarchyType
_hierarchyType)
// Sales
agreement cancellation process
case
HierarchyType::DNGRSSalesCancellation:
fieldId = fieldNum(DNGRSSalesAgreementCancellationHeader,
CancellationID);
break;
hierarchyType2ParentType(HierarchyType
_hierarchyType)
// Sales
agreement cancellation process
case
HierarchyType::DNGRSSalesCancellation :
parentType = smmActivityParentType::DNGRSSalesCancellation;
break;
hierarchyType2tableId(HierarchyType
_hierarchyType)
// Sales
agreement cancellation process
case
HierarchyType::DNGRSSalesCancellation:
refTableId = tableNum(DNGRSSalesAgreementCancellationHeader);
break;
isHierarchyTypeCRM(HierarchyType
_hierarchyType)
_hierarchyType ==
HierarchyType::DNGRSSalesCancellation ||
parentType2HierarchyType(smmActivityParentType _parentType)
case
smmActivityParentType::DNGRSSalesCancellation :
hierarchyType =
HierarchyType::DNGRSSalesCancellation;
break;
tableId2hierarchyType(TableId _tableId)
case
tableNum(DNGRSSalesAgreementCancellationHeader):
// if
(isConfigurationkeyEnabled(configurationKeyNum(PublicSector)))
{
hierarchyType =
HierarchyType::DNGRSSalesCancellation;
}
break;
4.2.
smmActivities
initFromCommonUsingTemplate(Common
_table, smmActivities _templateActivity)
// added by
case
tableNum(DNGRSSalesAgreementCancellationHeader)
:
SalesAgreementCancellationHeader =
_table;
this.initFromHierarchyTemplate(_templateActivity,
DateTimeUtil::date(SalesAgreementCancellationHeader.CreatedDateTime));
parentType =
smmActivityParentType::DNGRSSalesCancellation;
break;
Step 5. Add code in
Classes
5.1).
smmActivityParentLink
getLinkedTypes(smmActivityParentType
_parentType)
//added by
case
smmActivityParentType::DNGRSSalesCancellation:
con =
[smmActivityParentType::DNGRSSalesCancellation, smmActivityParentType::DNGRSSalesCancellation];
break;
getLookupFields(smmActivityParentType
_smmActivityParentType)
case
smmActivityParentType::DNGRSSalesCancellation :
fields = [fieldStr(DNGRSSalesAgreementCancellationHeader,
SalesCancellationProcess)];//,
break;
parentType2FieldId(smmActivityParentType
_parentType)
//added by
case
smmActivityParentType::DNGRSSalesCancellation :
fieldId = fieldNum(DNGRSSalesAgreementCancellationHeader,CancellationID);
break;
parentType2FieldName(smmActivityParentType
_parentType)
//added by
case
smmActivityParentType::DNGRSSalesCancellation :
name = fieldStr(DNGRSSalesAgreementCancellationHeader,CancellationID);
break;
parentType2RefTableId(smmActivityParentType
_parentType)
//added by
case
smmActivityParentType::DNGRSSalesCancellation :
tableId = tableNum(DNGRSSalesAgreementCancellationHeader);
break;
5.2). smmCreateEntity
createLinkCommon(Common _common, Common
_newRecord)
case
tableNum(DNGRSSalesAgreementCancellationHeader)
: //by kiran as on 30-01-2014 for sales agreement
activity
Step 6. Forms :: DNGRSSalesAgreementCancellation
Form -->Main DataSource-->Writer()
public
void write()
{
NoYes newRecord;
HierarchyName oldProcess;
boolean ret;
;
ttsbegin;
newRecord =
DNGRSSalesAgreementCancellationHeader.RecId ? NoYes::No : NoYes::Yes;
oldProcess =
DNGRSSalesAgreementCancellationHeader.orig().SalesCancellationProcess;
super();
ret =
element.setProcessInstance(oldProcess,
DNGRSSalesAgreementCancellationHeader.SalesCancellationProcess) ;
if
(!ret)
{
ttsabort;
DNGRSSalesAgreementCancellationHeader_ds.reread();
return;
}
// If
called from other form and creating a new record
if
(callerRecord && newRecord)
{
//
Copy associations for the caller record
smmCreateEntity::createLinkCommon(callerRecord,
DNGRSSalesAgreementCancellationHeader);
}
if
(newRecord)
{
DirParty::showHideMessageBar(element,DNGRSSalesAgreementCancellationHeader);
}
ttscommit;
}
Form
method
public
boolean
setProcessInstance(HierarchyName _oldProcess, HierarchyName _newProcess)
{
DialogButton answer = DialogButton::Yes;
if
(_oldProcess && _oldProcess !=_newProcess)
{
//
Do you want to remove all open activities?
answer = Box::yesNoCancel("@SYS109839", DialogButton::Cancel);
if
(answer == DialogButton::Cancel)
{
return
checkFailed("@SYS25904"); //Update has been canceled.
}
}
smmProcessInstance::write(DNGRSSalesAgreementCancellationHeader,
_oldProcess, _newProcess, false,
answer == DialogButton::Yes);
return
true;
}
Step 6. Create one menu item
with type:: Display
Place this menu item in to setup place in
area page pane
Set the properties
After that create one more action menu item
:
And assign below class to that menu item
class RESSaleAgreementCancellationProcess
{
}
static public void main(Args args, boolean _showForm = true)
{
smmProcessInstance smmProcessInstance;
RESSalesAgreementCancelTable RESSalesAgreementCancelTable;
;
if
(!args || !args.dataset())
{
throw
error("@SYS22996");
}
RESSalesAgreementCancelTable =
args.record();
// if (smmOpportunityTable.ProcessName)
{
smmProcessInstance =
smmProcessInstance::construct(RESSalesAgreementCancelTable);
}
if
(_showForm)
{
smmProcessInstance.openForm();
}
}
And place this menu item in to action pane
tab of form (and listpage)
And one drop dialog control in the action
pane tab below the above menu item
And assign the menuitem as : SmmChangeStage
(it is default )
And place this menu item then form look as: