Endorsement Custom Field

Questions about and code samples for custom order rules and validation within Select.
Post Reply
KWoods
Posts: 4
Joined: Tue Aug 27, 2019 12:26 pm

Endorsement Custom Field

Post by KWoods » Thu Nov 19, 2020 12:38 pm

I am trying to set the value of a custom field and need some assistance.

The field is on the Title>Endorsements page.

The Field code is {{Order.Title.Endorsements.ExceptionNumbers287_FNF#}}
Can you give a code snippet of how I can access this value?
CustomField.jpg
CustomField.jpg (197.7 KiB) Viewed 70 times
Thank you

BobRichards
Posts: 1006
Joined: Wed Jan 15, 2014 3:50 pm
Location: Raleigh, NC
Contact:

Re: Endorsement Custom Field

Post by BobRichards » Thu Nov 19, 2020 2:38 pm

We have to treat the hash symbol specially since it is not a valid character in the body of Python code - but it is a valid character for a Python function. (Yes - it's strange.) What we do is create a temporary name for the function where we put our code then rename it later.

For instance, I have a custom field on the endorsement context that is a string with the field code of "FCExample##". I create a dummy function name (Endorsement_FCExample) and put my value code in it. At the bottom of the code body, I rename it to the correct name so Select can find it when it runs. Please note that the word "name" at the bottom has two underscores at the beginning and end. Use the same strategy for Validate, ReadOnly, etc. aspect rules.

Code: Select all

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

def Endorsement_FCExample(args):
	args.Value = 'Hello'
	
Endorsement_FCExample.__name__ = 'Endorsement_FCExample##_Value'
Bob Richards, Software Developer, SoftPro

KWoods
Posts: 4
Joined: Tue Aug 27, 2019 12:26 pm

Re: Endorsement Custom Field

Post by KWoods » Thu Nov 19, 2020 3:36 pm

I'm sorry, I should have been more clear. I am using C#. I am not as familiar with python.

BobRichards
Posts: 1006
Joined: Wed Jan 15, 2014 3:50 pm
Location: Raleigh, NC
Contact:

Re: Endorsement Custom Field

Post by BobRichards » Thu Nov 19, 2020 3:47 pm

No worries. The "Custom Order Rules" forum is reserved for a type of Select rules written in Python. In the future, use the "Integration Development" forum or use a forum under it if it is a better fit. That way I know which language you want the answer in. :)

For C#, the field code is the property name. Below are two examples of getting values from the endorsement object.

Code: Select all

IOrderItem endorsement = ...;
string d = (string)endorsement.GetProperty("CDFChargeDescription");
string fc = (string)endorsement.GetProperty("ExceptionNumbers287_FNF#");
Bob Richards, Software Developer, SoftPro

Post Reply