I am working on a project that requires various Requirement and Exception Codes to be added to the orders based on Specific Criteria. which I am able to do using the following Snippet Example.
Code: Select all
from System import *
from SoftPro.ClientModel import *
from SoftPro.Select.Client import *
from SoftPro.OrderTracking.Client.Orders import *
# Add Requirement "zReq1" if it does not exist.
# Context = Order
def NeedsRequirements():
HasREQ = False #Set the overall Variable to False
##Check to see if the Requirement Code Already Exists
#for requirement in Context.Title.Commitments[0].Requirements:
# # If a Requirement Has no Code, go to the next one to evaluate
# if not requirement.Code:
# continue
# else:
# if requirement.Code.lower() == 'zreq1':
# HasREQ = True
# return
# Run the AddRequirement Function if the Requirement Variable is False.
if HasREQ == False:
AddRequirement('zReq1')
def AddRequirement(code):
req = IOrder.CreateNew(Context, 'Requirement')
req.Code = code
requirements = Context.Title.Commitments[0].Requirements
requirements.Add(req)
NeedsRequirements()
Why is this and what can I do to resolve this issue?