Examples
This ActivityUpdate will add a new cost line based on the specified definition
var update = {
AttributeAction: 0, //Add
AttributeType: 4, //CostLine
AttributeData: {
CostLineDefinitionId: "ACostDefinitionId"
}
}
This snippet will add a new line and set a quantity
var update = {
AttributeAction: 0, //Add
AttributeType: 4, //CostLine
AttributeData: {
CostLineDefinitionId: "ACostDefinitionId",
Fields: [{
AttributeAction: 0, //Add
AttributeType: 0, //Field
AttributeData: {
FieldName: "Quantity",
FieldValue: 20.5
}
}]
}
}
Update cost lines by an array of field model updates wrapped in a cost line model
var update = {
AttributeAction: 1, //Modify
AttributeType: 4, //CostLine
AttributeData: {
CostLineId: costLineId,
Fields: [{
AttributeAction: 1, //Modify
AttributeType: 0, //Field
AttributeData: {
FieldName: "Quantity",
FieldValue: 100
}
},{
AttributeAction: 1, //Modify
AttributeType: 0, //Field
AttributeData: {
FieldName: "Description",
FieldValue: "A new description"
}
}]
}
}
Properties
| Name | Description | Type | Additional information |
|---|---|---|---|
| CostLineId |
The cost line's Guid. This property will be ignored when adding a new cost line using the Web API. You will get the correct id in return from the server. Must be specified if you try to update or delete an existing cost line. When doing delete, this is the only property you have specify. |
string |
None. |
| CostLineDefinitionId |
The cost line definition id. You only have to specify this property when adding new cost lines. See LookupController.GetAvailableCostSetDefinitions() to get a list of available definition ids. For regular cost lines this will be a guid, but for costs coupled to requisitions this id will be on the format RequisitionNumber:RequisitionLine. |
string |
None. |
| CostSetDefinitionId |
Gets the cost set definition id, i.e. the cost set the line belongs to. This is field is just included for information purposes. |
string |
None. |
| CostLineCode |
Gets or sets the cost line code. It is basically a shortcut so you do not have to get the cost set definition in order to get the line code |
string |
None. |
| ClientId |
Gets or sets client id. An optional attribute that will follow the specific cost line only on the particular update. Is not saved across updates. Useful to differentiate between multiple new cost lines with the same definition id until an unique CostLineId has been assigned. |
string |
None. |
| ServiceCode |
Gets the service code for costline. This is field is just included for information purposes. |
string |
None. |
| ServiceCodeDescription |
Gets the service code description for costline. This field is just included for information purposes. |
string |
None. |
| IsDeletable |
Gets or sets a boolean indicating if current user can delete this cost line. |
boolean |
None. |
| IsOnlyAddableOnce |
Gets or set whether cost lines is only allowed to be added once, used with requisitions to connect one cost to one delivered part |
boolean |
None. |
| MinValue |
Gets or sets the minimum value you can set the Value field to, if no MinValue has been set it means that there is no restrictions on the minimum value (except that is must be equal or larger than zero as negative values are not allowed |
decimal number |
Json null value handling: Ignore |
| MaxValue |
Gets or sets the maximum value you can set the Value field to, if no MaxValue has been set it means that there is no restrictions on the maximum value. |
decimal number |
Json null value handling: Ignore |
| Fields |
Gets a list fields defined for a costline. You can expect the following fields to be available
|
Collection of AttributeUpdateModel |
None. |