Page 1 of 1

Define Assignment CORs - Reference not working

Posted: Mon Aug 21, 2023 5:08 pm
by amtech
I'm attempting to write CORs for custom fields that I have on assignments however I'm having an issue with CORs not being able to find the Assignment context. I'm using the standard <Context>_<Field>_<Aspect> format.

The simplest version of the code that is not working:

Code: Select all

from System import *
from SoftPro.ClientModel import *
from SoftPro.OrderTracking.Client import *
from SoftPro.OrderTracking.Client.Orders import *

def Assignment_ConsiderationAmount_Value(args):
	args.Value = 1000

def Assignment_ConsiderationAmount_Validate(args):
	args.RaiseWarning("ConsiderationAmount")

def Assignment_InterestFromDate_Validate(args):
	args.RaiseWarning("InterestFromDate")
I'm getting the blue underlines on all of the function definitions and they are not functioning. I have tried both Assignment and Assignments. I have no issue creating CORs for other fields or even for AssignmentParty (example below that works).

Code: Select all

from System import *
from SoftPro.ClientModel import *
from SoftPro.OrderTracking.Client import *
from SoftPro.OrderTracking.Client.Orders import *

def AssignmentParty_Name_Validate(args):
	args.RaiseWarning("AssignmentParty")
Below is the broader context of what I'm attempting to get to work. Everything is working except the assignment custom field.

Code: Select all

from System import *
from SoftPro.ClientModel import *
from SoftPro.OrderTracking.Client import *
from SoftPro.OrderTracking.Client.Orders import *

def ExistingLien_InstrumentTypeUA_Value(args):
	if (args.Context.InstrumentType.Code == "CEMA"):
		args.Value = "CONSOLIDATION, EXTENSION AND MODIFICATION AGREEMENT"
	elif (args.Context.InstrumentType.Code == "EMA"):
		args.Value = "EXTENSION AND MODIFICATION AGREEMENT"
	elif (args.Context.InstrumentType.Code == "MOD"):
		args.Value = "MODIFICATION AGREEMENT"
	else:
		args.Value = args.Context.InstrumentType.Description

def Assumption_InstrumentTypeUA_Value(args):
	if (args.Context.AssumptionModification.IsOther):
		if (args.Context.InstrumentType.Code == "CEMA"):
			args.Value = "CONSOLIDATION, EXTENSION AND MODIFICATION AGREEMENT"
		elif (args.Context.InstrumentType.Code == "EMA"):
			args.Value = "EXTENSION AND MODIFICATION AGREEMENT"
	elif (args.Context.AssumptionModification.IsModification):
		args.Value = "MODIFICATION OF " + IOrderItem.GetProperty(args.Context, 'InstrumentType_UA##').upper()
	elif (args.Context.AssumptionModification.IsAssumption):
		args.Value = "ASSUMPTION OF " + IOrderItem.GetProperty(args.Context, 'InstrumentType_UA##').upper()
	else:
		" OF " + IOrderItem.GetProperty(args.Context, 'InstrumentType_UA##')

def Assignment_InstrumentTypeUA_Value(args):
	""" Set InstrumentType_UA# custom field value to InstrumentType.Description """
	args.Value = "ASSIGNMENT OF " + IOrderItem.GetProperty(args.Context.Parent, 'InstrumentType_UA##')

# Redefine Custom Field Rule names to allow mapping to any field name.
#    This should be at the bottom of the file.
ExistingLien_InstrumentTypeUA_Value.__name__ = "ExistingLien_InstrumentType_UA##_Value"
Assumption_InstrumentTypeUA_Value.__name__ = "ExistingLien_Assumption_InstrumentType_UA##_Value"
Assignment_InstrumentTypeUA_Value.__name__ = "Assignment_InstrumentType_UA##_Value"
I did see in a thread from 2021 the possibility that custom fields with underscores could cause issues but I'm not seeing that with my other custom fields and I'm seeing the issue on the two fields with assignment as a parent. viewtopic.php?p=6120

Please let me know if you need screenshots or any additional information.

Re: Define Assignment CORs - Reference not working

Posted: Tue Aug 22, 2023 2:12 pm
by vmrvichin
Try it with just one # in your redefinitions. like this:

Code: Select all

# Redefine Custom Field Rule names to allow mapping to any field name.
#    This should be at the bottom of the file.
ExistingLien_InstrumentTypeUA_Value.__name__ = "ExistingLien_InstrumentType_UA#_Value"
Assumption_InstrumentTypeUA_Value.__name__ = "ExistingLien_Assumption_InstrumentType_UA#_Value"
Assignment_InstrumentTypeUA_Value.__name__ = "Assignment_InstrumentType_UA#_Value"
If that doesn't work, please provide a screenshot of the properties page on one of your custom field definitions.

Re: Define Assignment CORs - Reference not working

Posted: Tue Aug 22, 2023 3:10 pm
by amtech
Good afternoon Vlad,

I'm running Select version 4.3.57 in hosted but I'm also testing this in an on-prem environment with the same results.

Unfortunately that breaks the CORs for custom fields that were working and does not fix the Assignments.
Image

I'm having issues creating rules for any COR with a context of Assignments, see below for a screenshot of the editor.
Image

Context for Consideration Amount, which CORs are also not working for:
Image

There is nothing related in the event log of the client, mid-tier, or database servers of the on prem instance.

Please let me know if you require any additional information.

Re: Define Assignment CORs - Reference not working

Posted: Tue Aug 22, 2023 3:16 pm
by amtech
Also to rule out the possibility that the naming convention of the function definitions was causing the issue, I tried the below with the same results:

Code: Select all

from System import *
from SoftPro.ClientModel import *
from SoftPro.OrderTracking.Client import *
from SoftPro.OrderTracking.Client.Orders import *

def ExistingLienInstrumentTypeUAValue(args):
	if (args.Context.InstrumentType.Code == "CEMA"):
		args.Value = "CONSOLIDATION, EXTENSION AND MODIFICATION AGREEMENT"
	elif (args.Context.InstrumentType.Code == "EMA"):
		args.Value = "EXTENSION AND MODIFICATION AGREEMENT"
	elif (args.Context.InstrumentType.Code == "MOD"):
		args.Value = "MODIFICATION AGREEMENT"
	else:
		args.Value = args.Context.InstrumentType.Description

def AssumptionInstrumentTypeUAValue(args):
	if (args.Context.AssumptionModification.IsOther):
		if (args.Context.InstrumentType.Code == "CEMA"):
			args.Value = "CONSOLIDATION, EXTENSION AND MODIFICATION AGREEMENT"
		elif (args.Context.InstrumentType.Code == "EMA"):
			args.Value = "EXTENSION AND MODIFICATION AGREEMENT"
	elif (args.Context.AssumptionModification.IsModification):
		args.Value = "MODIFICATION OF " + IOrderItem.GetProperty(args.Context, 'InstrumentType_UA##').upper()
	elif (args.Context.AssumptionModification.IsAssumption):
		args.Value = "ASSUMPTION OF " + IOrderItem.GetProperty(args.Context, 'InstrumentType_UA##').upper()
	else:
		" OF " + IOrderItem.GetProperty(args.Context, 'InstrumentType_UA##')

def AssignmentInstrumentTypeUAValue(args):
	args.Value = "ASSIGNMENT OF " + IOrderItem.GetProperty(args.Context.Parent, 'InstrumentType_UA##')

ExistingLienInstrumentTypeUAValue.__name__ = "ExistingLien_InstrumentType_UA##_Value"
AssumptionInstrumentTypeUAValue.__name__ = "ExistingLien_Assumption_InstrumentType_UA##_Value"
AssignmentInstrumentTypeUAValue.__name__ = "Assignment_InstrumentType_UA##_Value"

Re: Define Assignment CORs - Reference not working

Posted: Tue Aug 22, 2023 4:48 pm
by BobRichards
Your code is not being parsed as you expect by Select. Select uses underscores to separate the <Context>,<Field>, and <Aspect> portions of the identifier you give it. I does not look for a "Context" then examine the list of fields/custom fields for a legal field. It just breaks strings up by underscores.

Your identifier "ExistingLien_InstrumentType_UA##_Value" is parsed as Context:"ExistingLien", Field:"InstrumentType", Aspect:"UA##_Value". This aspect is not valid. If you want to use custom fields as COR function names, they must conform to COR naming conventions. If a custom field is only used for data storage and retrieval, it does not have to follow strict underscore rules.

Re: Define Assignment CORs - Reference not working

Posted: Tue Aug 22, 2023 5:24 pm
by amtech
I saw your response in an older thread and thought I'd run into issues but it's working fine for the existing liens CORs on custom fields.
Image

I created a new custom field with no underscores (and restarted Select) to test if that was an issue specific to Assignments and I'm having the same issue.
Image

Code: Select all

from System import *
from SoftPro.ClientModel import *
from SoftPro.OrderTracking.Client import *
from SoftPro.OrderTracking.Client.Orders import *

def Assignment_ConsiderationAmount_Value(args):
	args.Value = 1000.0

def Assignment_ConsiderationAmount_Validate(args):
	args.RaiseWarning("ConsiderationAmount")

def Assignment_InterestFromDate_Validate(args):
	args.RaiseWarning("InterestFromDate")

def Assignment_CopyFromPreviousAssignment_Validate(args):
	args.RaiseWarning("CopyFromPreviousAssignment")

def Assignment_AltInstrumentTypeUA_Value(args):
	args.Value = "ASSIGNMENT OF " + IOrderItem.GetProperty(args.Context.Parent, 'InstrumentType_UA##')

def Assignment_AltInstrumentTypeUA_Validate(args):
	args.RaiseWarning("InstrumentType all in one")

Assignment_AltInstrumentTypeUA_Value.__name__ = "Assignment_InstrumentTypeUA##_Value"
Assignment_AltInstrumentTypeUA_Value.__name__ = "Assignment_InstrumentTypeUA##_Validate"
Image

I know we are focusing on the Assignment Custom Field COR but I think the issue might be with the Assignment context since I'm unable to get CORs for ConsiderationAmount, InterestFromDate, or CopyFromPreviousAssignment to work.

Re: Define Assignment CORs - Reference not working

Posted: Tue Aug 22, 2023 6:05 pm
by BobRichards
OK. We're half way there. If you bring up "ConsiderationAmount, InterestFromDate, or CopyFromPreviousAssignment" in the field code browser it will indicate the correct context as "ExistingLienAssignment". Pressing ALT+F6 with your cursor in the "ConsiderationAmount" field should give the same results - but it doesn't. I have never seen this before.
2023-08-23_11-16-53.jpg
2023-08-23_11-16-53.jpg (45.1 KiB) Viewed 8117 times
2023-08-22_17-53-27.jpg
2023-08-22_17-53-27.jpg (40.99 KiB) Viewed 8120 times
Here is an example of working code:

Code: Select all

def ExistingLienAssignment_ConsiderationAmount_Value(args):
	args.Value = 666
Try using the new context with your code and let me know the result.

(Added the screen shot of the ALT+F6 incorrect view so I could capture all information associated with issue. Bob)

Re: Define Assignment CORs - Reference not working

Posted: Tue Aug 22, 2023 6:35 pm
by amtech
That did it! Custom field CORs and CORs for the three fields on ExistingLienAssignment are all working. I've gotten so used to Alt+F6 to find that information that I forgot there was another reference at the bottom of the field code browser. Reading solves most issues.

The help is always very appreciated. Thanks Bob and Vlad!