Automation to add note if certain customer name chosen

Questions about and code samples for automation process code snippets within Select.
Post Reply
bozora
Posts: 3
Joined: Fri Sep 08, 2023 5:26 pm

Automation to add note if certain customer name chosen

Post by bozora »

Good morning,

First time caller, long time listener. I don't know much about automation coding except what I self taught myself from existing automations (and piecing together notes from the forum), so bear with me! I (think) I'm getting close to figuring out the following automation, but I'm clearly missing a piece. The automation runs successfully (as in doesn't fail), but does not add the note. The point of the automation is to add a note when a certain broker is chosen so that it pops up as a reminder for the title examiner when issuing the title commitment. Any help you can give me would be greatly appreciated! Thanks! Callie

If:
First Time order is saved
Order has a contact (field is specific value)
{{Order.ListingAgentBrokers[0].People[0].LookupCode}} = TSCHULTZ
Order Status = In Process



Then (Code Snippet):
from System import *
from SoftPro.ClientModel import *
from SoftPro.Select.Client import *
from SoftPro.OrderTracking.Client.Orders import *

# Get an empty note from the order and get the Order object.
# If order is not context (i.e. Task is context), then use "order = Context.Root"
# Get the root order from the context

Order = Context.root

# Check if broker name = true
for People in Context.ListingAgentBrokers:
if People.LookupCode.startswith('TSCHULTZ'):
# Create a new note
note = IOrder.CreateNew(Context, 'Note')
note.Text = 'Tom Schultz requires all title documents to be merged into one single PDF'
note.Type = NoteType.Information
note.Catergories = None
note.DisplayOnOrderOpen = True
Context.Notes.Add(note)
vmrvichin
Posts: 27
Joined: Thu Jul 22, 2021 11:50 am

Re: Automation to add note if certain customer name chosen

Post by vmrvichin »

your problem is in what you are iterating over

Code: Select all

for People in Context.ListingAgentBrokers:
That line is iterating over the ListingAgentBrokers collection, and not the people collection under a specific ListingAgentBroker like I think you are intending. So you either need 2 for loops, one iterating over the ListingAgentBrokers collection and then another iterating over the People collection under each ListingAgentBroker, or you need to specify a specific ListingAgentBroker in your for loop such as:

Code: Select all

for People in order.ListingAgentBrokers[0].People:
That said, I'm not sure why you are trying to iterate over any of the ListingAgentBrokers or the people under them in the code snippet, since in the conditions for the automation to even run, you've specified that the first person under the first listing agent has to have a lookup code of TSCHULTZ. If that's really what you are going for, then you don't need any more loops or if statements in your code snippet, just add the note.
Vlad Mrvichin, Senior Software Developer, Custom Dev, SoftPro
bozora
Posts: 3
Joined: Fri Sep 08, 2023 5:26 pm

Re: Automation to add note if certain customer name chosen

Post by bozora »

Thank you for your help
Post Reply