CreateCase()
A CreateCase() function creates a new case within a specified procedure. Optionally these parameters may be set:
- a stage name;
- a case title;
- whether the newly created case is connected to its source (calling) case;
- an owner.
Syntax
CreateCase(procedureName); CreateCase(procedureName, stageName); CreateCase(procedureName, stageName, caseTitle); CreateCase(procedureName, stageName, caseTitle, setConnected); CreateCase(procedureName, stageName, caseTitle, setConnected, owner);
Function arguments
- procedureName – (String) a name of the procedure;
- stageName – (String) [optional] a name of the procedure stage. If ommited or empty, the first starting stage will be selected;
- caseTitle – (String) [optional] a title of the case. If ommited or empty, the title will be created from the procedure name and ID of the created case;
- setConnected – (Boolean) [optional] if set to true then the newly created case will be marked as connected to the source case. Additionally, if there are fields of the same name and type in both cases (the newly created and the source one) values of these fields will be copied;
- owner – (String) [optional] a user to whom the newly created case will be assigned.
Return value
This function returns Decimal.
The CreateCase() function returns an id of the newly created case.
Examples
Example 1
This will create a new case within the procedure named 'Company’, the stage 'New’ and the case title as set in [Client Name] case field. The returned case id is then used in Set() function.
caseId = CreateCase("Company", "New",[Client Name]); Set(caseId, "Address",[Client Address]);
Example 2
This will create a new case within the procedure named 'Company’, the stage 'New’, the case title 'New company’ and mark it as connected to the current/source case.
CreateCase("Company", "New","New company", true);
Example 3
This will create a new case within the procedure named 'Company’, the stage 'New’, the case title 'New company’, will mark it as connected to the current/source case and finally will assign it to the user John Doe.
CreateCase("Company", "New", "New company", true, "John Doe");