Has anyone else had any issues when trying to check the approval status of a component? I am using the code below, to check if a component meets the minimum approval status, before performing some logic.
Component component = (Component)engine.GetObject(new TcmUri(itemId,
itemType, publicationId));
if (component.ApprovalStatus == null
|| engine.PublishingContext.PublicationTarget.MinApprovalStatus == null
|| component.ApprovalStatus.Position >=
engine.PublishingContext.PublicationTarget.MinApprovalStatus.Position)
{
//some logic
}
However the code fails with the following error if I just run the code. (The line of code it actually fails on is the if statement).
EDIT: Forgot to mention the item doesn't meet the minimum approval status but should just perform the check and not go into the logic.
Item tcm:X-XXXX does not meet the minimum approval status
However this is not the case if I remote debug and actually inspect the variables individually when running through (if I don't inspect them it still fails)
I have tagged this as workflow as it's to do with approval status, didn't really know what else to tag it as. So sorry if this is wrong