system.kanoa.lot.unlinkLotOperationItem
Description
Unlinks an item from a lot operation. The function attempts to delete the link record; if deletion fails, it disables the link instead.Syntax
unlinkLotOperationItem(lotOperationItemLinkId, userId)Parameters:
– lotOperationItemLinkId (int): The ID of the item-operation link to remove.
– userId (int): User performing the unlink operation.
Returns:
– message (string): Indicates the result of the action. Returns “Deleted”, “Disabled”, or an error message if the link could not be found.
Behavior
The function:– Validates the provided link ID exists via system.kanoa.lot.getLotOperationItemLinks().
– Attempts to delete the link from mes.lotOperationItemLink.
– If deletion fails (e.g., due to constraints), disables the link via system.kanoa.lot.enableLotOperationItemLink().
– Returns “Deleted” if removed, “Disabled” if disabled, or a not-found message if the link does not exist.
Parameters
Parameter | Type | Required | Notes |
---|---|---|---|
lotOperationItemLinkId | int | Yes | ID of the lot-operation-to-item link record to remove |
userId | int | Yes | User performing the unlink operation |
Code Examples
# Delete a specific lot-operation-to-item link
lotOperationItemLinkId = 8801
message = system.kanoa.lot.unlinkLotOperationItem(
lotOperationItemLinkId=lotOperationItemLinkId,
userId=123
)
print(message) # "Deleted" or "Disabled"
# Attempt to unlink a non-existent link
message = system.kanoa.lot.unlinkLotOperationItem(
lotOperationItemLinkId=999999,
userId=123
)
print(message) # "This item link cannot be found"