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?
Thank you
Endorsement Custom Field
-
- Posts: 1377
- Joined: Wed Jan 15, 2014 3:50 pm
- Location: Raleigh, NC
- Contact:
Re: Endorsement Custom Field
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.
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, Senior Software Developer, SoftPro
Re: Endorsement Custom Field
I'm sorry, I should have been more clear. I am using C#. I am not as familiar with python.
-
- Posts: 1377
- Joined: Wed Jan 15, 2014 3:50 pm
- Location: Raleigh, NC
- Contact:
Re: Endorsement Custom Field
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.
![Smile :)](./images/smilies/icon_e_smile.gif)
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, Senior Software Developer, SoftPro