We are trying to set the Title Stauts to blank if the order status is set to canceled. Please see below rule and let me know if there is an option to be able to set this to blank:
def Title_Status_Value(args):
o = args.Context.Root
oTCA = ['TO','TE']
oTC = o.Type.Code
iT = o.IsTemplate
oS = o.Status
oSCA = OrderStatus.Canceled
oSDU = OrderStatus.Duplicate
tSI = TitleStatus.InProcess
tSCA = TitleStatus.Canceled
exemptProfiles = ['NULL']
profilePath = o.OwnershipProfile.Path
for profile in exemptProfiles:
if profile not in profilePath:
if not iT and oTC in oTCA and oS != oSCA:
args.Value = tSI
elif not iT and oTC in oTCA and oS == oSCA:
args.Value = tSCA
elif not iT and oTC in oTCA and oS == oSDU:
args.Value == None
else:
args.RunDefaultRule()
else:
args.RunDefaultRule()
Title Status Set to Blank
-
- Posts: 1382
- Joined: Wed Jan 15, 2014 3:50 pm
- Location: Raleigh, NC
- Contact:
Re: Title Status Set to Blank
Please repost the Python code inside of "Code" tags to perserve the whitespace. You can enter these tags by pressing the
button in the ribbon above the text entry box.Bob Richards, Senior Software Developer, SoftPro
-
- Posts: 5
- Joined: Thu Jun 15, 2023 1:40 pm
Re: Title Status Set to Blank
Code: Select all
def Title_Status_Value(args):
o = args.Context.Root
oTCA = ['TO','TE']
oTC = o.Type.Code
iT = o.IsTemplate
oS = o.Status
oSCA = OrderStatus.Canceled
oSDU = OrderStatus.Duplicate
tSI = TitleStatus.InProcess
tSCA = TitleStatus.Canceled
exemptProfiles = ['NULL']
profilePath = o.OwnershipProfile.Path
for profile in exemptProfiles:
if profile not in profilePath:
if not iT and oTC in oTCA and oS != oSCA:
args.Value = tSI
elif not iT and oTC in oTCA and oS == oSCA:
args.Value = tSCA
elif not iT and oTC in oTCA and oS == oSDU:
args.Value == None
else:
args.RunDefaultRule()
else:
args.RunDefaultRule()
-
- Posts: 23
- Joined: Wed Jul 12, 2023 11:29 am
Re: Title Status Set to Blank
You can use TitleStatus.None for the "blank" value. I tested this version of the rule. When I set the order status to Canceled, the Title Status is set to the "blank" value.
Code: Select all
def Title_Status_Value(args):
o = args.Context.Root
oTCA = ['TO','TE']
oTC = o.Type.Code
iT = o.IsTemplate
oS = o.Status
oSCA = OrderStatus.Canceled
oSDU = OrderStatus.Duplicate
tSI = TitleStatus.InProcess
tSCA = TitleStatus.Canceled
tSN = TitleStatus.None
exemptProfiles = ['NULL']
profilePath = o.OwnershipProfile.Path
for profile in exemptProfiles:
if profile not in profilePath:
if not iT and oTC in oTCA and oS != oSCA:
args.Value = tSI
elif not iT and oTC in oTCA and oS == oSCA:
args.Value = tSN
elif not iT and oTC in oTCA and oS == oSDU:
args.Value == None
else:
args.RunDefaultRule()
else:
args.RunDefaultRule()
-
- Posts: 5
- Joined: Thu Jun 15, 2023 1:40 pm
Re: Title Status Set to Blank
This worked for cancelled so I thought I could just use the same thing for when the order status is set to duplicate but the title status stays as in process.
Code: Select all
def Title_Status_Value(args):
o = args.Context.Root
oTCA = ['TO','TE']
oTC = o.Type.Code
iT = o.IsTemplate
oS = o.Status
oSCA = OrderStatus.Canceled
oSDU = OrderStatus.Duplicate
tSI = TitleStatus.InProcess
tSCA = TitleStatus.Canceled
tSN = TitleStatus.None
exemptProfiles = ['NULL']
profilePath = o.OwnershipProfile.Path
for profile in exemptProfiles:
if profile not in profilePath:
if not iT and oTC in oTCA and oS != oSCA:
args.Value = tSI
elif not iT and oTC in oTCA and oS == oSCA:
args.Value = tSN
elif not iT and oTC in oTCA and oS == oSDU:
args.Value = tSN
else:
args.RunDefaultRule()
else:
args.RunDefaultRule()
-
- Posts: 23
- Joined: Wed Jul 12, 2023 11:29 am
Re: Title Status Set to Blank
The first if statement is grabbing everything where the order status is not Canceled. That means if the order status is Duplicate, it will fall into the first if statement. Reordering your if statements and removing the check for oS != oSCA should do the trick. Here is a snippet you can try.
You could also move the conditions that you check on every if statement into one if statement, then setting Title Status to InProcess becomes just an else statement.
Code: Select all
for profile in exemptProfiles:
if profile not in profilePath:
if not iT and oTC in oTCA and oS == oSCA:
args.Value = tSN
elif not iT and oTC in oTCA and oS == oSDU:
args.Value = tSN
elif not iT and oTC in oTCA:
args.Value = tSI
else:
args.RunDefaultRule()
else:
args.RunDefaultRule()
Code: Select all
for profile in exemptProfiles:
if profile not in profilePath and not iT and oTC in oTCA:
if oS == oSCA:
args.Value = tSN
elif oS == oSDU:
args.Value = tSN
else:
args.Value = tSI
else:
args.RunDefaultRule()