Hi,
I have a custom field in the Order context which is a List of values type.
How can I get the value of this custom field via code snippet?
The code snippet is triggered when a file is saved / closed.
Many thanks !!
Retrieving the value of a custom field
-
- Posts: 1377
- Joined: Wed Jan 15, 2014 3:50 pm
- Location: Raleigh, NC
- Contact:
Re: Retrieving the value of a custom field
A drop-down custom field is a list of strings. For this example, let's say you are using this drop-down custom field on the Order context.
Finally, we create a new order, set the new field (Order.DemoDropDown##) to "Item #3" then save the order. When the code runs, this message will be written to the Event Viewer.
First, we then create an automation snippet that runs every time an order is saved. Use the code below for the "Then" clause.
Code: Select all
from System import *
from SoftPro.OrderTracking.Client.Orders import *
# Write to event viewer
import System.Diagnostics as SD
# Context is Order.
def MyFunc():
s = 'Context: %s' % str(Context)
s += '\nOrder.DemoDropDown## = '
s += IOrderItem.GetProperty(Context,'DemoDropDown##')
SD.Trace.TraceWarning(s)
MyFunc()
Code: Select all
Context: Order XAT22002270
Order.DemoDropDown## = Item #3
Bob Richards, Senior Software Developer, SoftPro
Re: Retrieving the value of a custom field
Perfect!
Many thanks
Many thanks