CLI Reference > Workflows and Documents Commands > im createsegment
  
im createsegment
creates a new segment
Synopsis
im createsegment[--insertMode=[reference:include]] [--insertLocation=number[first|last|before:name|after:name] [--parentID=value] [--type=type] [--addAttachment=value] [--addRelationships=value] [--addSourceTrace=value] [--addSourceLink=value] [--customFieldValue=value] [--field=value] [--richContentField=value] [--project=value] [--user=name] [--hostname=server] [--password=password] [--port=number] [--quiet] [(-?|--usage)] [(-F file|--selectionFile=file)] [(-N|--no)] [(-Y|--yes)] [--[no]batch] [--cwd=directory] [--forceConfirm=[yes|no]] [-g|--gui] [--settingsUI=[gui|default]] [--status=[none|gui|default]]
Description
im createsegment creates a new segment. A segment can be a document root or a subsegment. For example:
im createsegment --field='Project=/Project2/Release 1.0' --type='Test Document' --field='Category=Document'
creates a test document
im createsegment --parentID=123 --field='Project=/Project2' --type='Requirement Document'
creates a requirement document under document root 123.
Options
This command takes the universal options available to all im commands, as well as some general options. See the options reference page for descriptions.
--insertMode=[reference:include] indicates how the segment is to be inserted into a segment root. This option is required if you specify a --parentID. The options are as follows:
reference references related issues but does not include them.
include includes related issues as children of the parent issue.
--field=value
specifies a field and its value, where value is of the form "fieldName=fieldValue", for example, --field=Severity=Critical. If the field is multi-valued, value is of the form "fieldName=fieldValue,...".
To specify more than one field, specify this option for each field you want to add.
To specify a Windchill RV&S project, project names must be preceded by a (/), for example, --field=Project=/testProject.
To specify a configuration management project, use the following syntax: --field=fieldname,server=server, project=projectname,[devpath=devpath|revision=checkpointrevision]
--addRelationships=value
adds related issues to the segment, where value is of the form [FieldName]:IssueID[relationshipFlags][,...]. If no field name is specified, the Forward Relationships field is used.
* 
Adding a related issue is only permitted if your administrator has allowed relationships for the segment's issue type.
--addSourceTrace=value
adds a trace to a source file, where value is of the form "field=scmSourceFieldName,server=scmServerName,port=scmPortNumber,file=fileName,project=scmProjectName[,devpath=devpathName] [,projectRevision=revision][,start=startLineNumber][,end=endLineNumber]".
Note the following:
If you specify a configuration path for project=scmProjectName then devpath=devpathName and projectRevision=revision cannot be specified.
You cannot add the same source trace more than once. In order to be considered a new source trace, the trace must have a unique combination of the following attributes: member name, server name, server port, project, project revision, development path, revision, start line number, and end line number.
--addSourceLink=value
adds a link to a source file, where value is of the form "field=scmSourceFieldName,revision=memberRevisionID, server=scmServerName,port=scmPortNumber,[file=fileName|subproject=subprojectName|isProject],project=scmProjectName[,devpath=devpathName][,projectRevision=revision] [,start=startLineNumber][,end=endLineNumber]".
Note the following:
If you specify a configuration path for project=scmProjectName then devpath=devpathName and projectRevision=revision cannot be specified.
You cannot add the same source link more than once. In order to be considered a new source link, the link must have a unique combination of the following attributes: member name, server name, server port, project, project revision, development path, revision, start line number, and end line number.
--richContentField=value
specifies a rich content field and its value for the segment, where value is of the form "richcontentfieldname=fieldValue".
To specify a link to an item by ID:
<a href="mks:///item?itemid=ID">DisplayText</a>
For example:
<a href="mks:///item?itemid=4547">Part Requirement</a>
To specify a link to an item by ID and label:
<a href="mks:///item?itemid=ID&label=LABEL">DisplayText</a>
For example:
<a href="mks:///item?itemid=4547&label=EDF-343">Part Requirement, Label EDF-343</a>
To specify a link to an item by ID and revision:
<a href="mks:///item?itemid=ID&revision=REVISION">DisplayText</a>
For example:
<a href="mks:///item?itemid=4547&revision=1.2">Part Requirement, Revision 1.2</a>
To specify a link to an item by ID and date:
<a href="mks:///item?itemid=ID&asof=DATETIME">DisplayText</a>
where date is in the format for your locale; such as US date formats "mm/dd/yy", "mm/dd/yyyy", or "mmm d, yyyy" with the time "h:mm:ss a".
For example:
<a href="mks:///item?itemid=4547&asof=03/25/2012 12:04:00 AM">Part Requirement, March 25, 2012 12:04am</a>
* 
In the korn shell command line interface, HTML tags must be surrounded by quotes, for example,
""<b>Feature Overview/b>"
In the Windows command line interface (cmd.exe), the ^ escape character must precede the and > characters in HTML tags, for example,
^^<b^>Feature Overview^/b^>
You may need to escape nested " characters, for example,
--richContentField=Description="<a href=\"mks:///item?itemid=4547\">Part Requirement</a>"
--addAttachment=value
adds attachments to the segment, where value is of the form "fieldName,path=pathToFile[,name=nameOfAttachment][,summary=shortDescription]" .
* 
The "pathToFile" must include the path and filename. The "nameOfAttachment" is optional, and gives the attachment a different name than the name of the file specified in "pathToFile".
For example,
--type=type
specifies the type of the segment. Your administrator defines segment types. This option is required if more than one segment type is allowed and the type field is not specified.
--parentID=value
the ID of the parent segment or node that will contain the reference to the segment being created. This option is required.
--insertLocation=number[first|last|before:name|after:name]
determines where the segment should go in the parent segment's structural relationship list. You must specify a --parentID. The options are as follows:
first inserts the segment at the beginning of the list
last inserts the segment at the end of the list
before:<ID> inserts the segment before the specified ID
after:<ID> inserts the segment after the specified ID
[0,...] inserts the segment at the specified location. If a negative is specified, the segment is inserted at the beginning of the list. If the number specified is too large, the segment is inserted at the end of the list.
--insertMode=[reference:include]
indicates how the segment is to be inserted into a segment root. This option is required if you specify a --parentID. The options are as follows:
reference references related issues but does not include them.
include includes related issues as children of the parent issue.
addAttachment="field=Attachments,path=c:/temp/notes.txt,name=notes123.txt,summary="Notes for issue 123""
adds the existing notes.txt file as an attachment with the name of notes123.txt.
If you do not specify the name of the attachment, the file name is used as the attachment name. You can use this option multiple times to specify multiple attachments. A segment cannot have more than one attachment with the same name.
* 
Attachment size limits are set by your administrator. The default attachment size limit is 4 MB.
See Also
Commands: im viewsegment, im branchsegment, im insertsegment, im importsegment
Miscellaneous:diagnostics, options, preferences