createInstance method: List class
Syntax
createInstance(instance_ID, title, &context_data)
Description
Use this method to create an activity guide instance by cloning the current activity guide template including its action items, participants, and so on.
Parameters
| Parameter | Description |
|---|---|
|
instance_ID |
Specifies the ID for the activity guide instance as a string. |
|
title |
Specifies the title for the activity guide instance as a string. Note: The title is also referred to as the Label property. |
|
&context_data |
Specifies the contextual data for the activity guide instance as a PTAI_COLLECTION:Collection object. |
Returns
A List object.
Example
This is a code example of the CreateInstance method:
method CreateInstFromCtxtData
/+ &oCtxt as PTAI_COLLECTION:Collection +/
/+ Returns String +/
Local PTAI_ACTION_ITEMS:ContextData &ctxData;
Local PTAI_ACTION_ITEMS:List &newList = create PTAI_ACTION_ITEMS:List();
Local PTAI_COLLECTION:Collection &ctxDataColl = create PTAI_COLLECTION:Collection();
Local integer &i, &nbr;
Local string &label, &descr, &InstanceId;
try
For &i = 1 To &oCtxt.Count
&ctxData = (&oCtxt.Item(&i) As PTAI_ACTION_ITEMS:ContextData);
If &ctxData.ctxKey And
&ctxData.keyValue = "" Then
Return "";
End-If;
&ctxDataColl.InsertItem(&ctxData);
End-For;
&newList.open(&Template_Id);
SQLExec(SQL.PTAI_GET_INSTANCES, &newList.ListId, &nbr);
&nbr = &nbr + 1;
&label = &newList.Label | "-" | &nbr;
&InstanceId = &newList.createInstance(&label, &newList.DescrLong, &ctxDataColl).ListId;
Return &InstanceId;
catch Exception &e
Return "";
end-try;
end-method;