SellerProceeds.Is1099Provided

Questions about and code samples for automation process code snippets within Select.
Post Reply
B_Hinote
Posts: 57
Joined: Tue Jan 08, 2019 7:20 pm

SellerProceeds.Is1099Provided

Post by B_Hinote »

I have been able to create simple Code Snippets, using examples and basic logic, but apparently, I am not getting how to check the value of the {{Order.Sellers.Proceeds.Is1099Provided}} Field.

I assume that I need to use "for seller in Context.Sellers:" to loop through the Sellers. However, ".Proceeds" appear to be of type "SellerProceeds", with "Is1099Provided" being a property of that object.

After various failed attempts trying to determine if any of the sellers had the Is1099Provided set to True, I was wondering if you could please provide a basic example of how this can be done.

Ultimately I am trying to add a Task to the order when any of the Sellers has the Is1099Provided checked. (i.e. First time any of them gets checked, but not each time one is checked.)

Thank you in advance for your assistance.
B_Hinote
Posts: 57
Joined: Tue Jan 08, 2019 7:20 pm

Re: SellerProceeds.Is1099Provided

Post by B_Hinote »

I cannot seem to find a way to edit/add to my original post, so I am replying with the following information just in case it promotes someone to pity my feeble efforts. :-)

The code that I was experimenting with is below, with several of my failed attempts commented out.

I am reasonably sure that I need to use "for seller in Context.Sellers:" to loop through each of the Sellers, unless there is a simple way to test for any of the sellers having the field checked with a single statement, as this is all I am trying to determine. My issue seems to be with the ".Is1099Provided" being under the context of "SellerProceeds" or at least that is what I am thinking. 😄

from System import *
from SoftPro.ClientModel import *
from SoftPro.Select.Client import *

def WasProvided():
for seller in Context.Sellers:
#if seller.Proceeds.Is1099Provided = True:
#if seller.SellerProceeds.Is1099Provided = True:
#proceed = seller.SellerProceeds
#proceed = seller.Proceeds
#if proceed.Is1099Provided = True:
#if Context.SellerProceeds.Is1099Provided = True:
#if Context.Proceeds.Is1099Provided = True:
#proceed = Context.SellerProceeds
if ?.Is1099Provided = True:
return True

return False

WasProvided()
BobRichards
Posts: 1376
Joined: Wed Jan 15, 2014 3:50 pm
Location: Raleigh, NC
Contact:

Re: SellerProceeds.Is1099Provided

Post by BobRichards »

You are correct that you need to write a loop to examine all the sellers - one at a time. Proceeds as a property of a Seller Is1099Provided is a property of Proceeds. So you should be able to do something like this...

Code: Select all

for seller in Context.Sellers:
    if seller.Proceeds.Is1099Provided == True:
        return True
(Also, I changed your code to use double equals sign. That's how Python does comparisons. Single equals means assignment.)
Bob Richards, Senior Software Developer, SoftPro
B_Hinote
Posts: 57
Joined: Tue Jan 08, 2019 7:20 pm

Re: SellerProceeds.Is1099Provided

Post by B_Hinote »

Thank you for your reply.
I change the code as follows but still had no luck detecting that the second seller has this field checked. For testing purposes, I have set this process to "Every Time" the order is saved.

Code: Select all

from System import *
from SoftPro.ClientModel import *
from SoftPro.Select.Client import *

def WasProvided():
	for seller in Context.Sellers:
    	if seller.Proceeds.Is1099Provided == True:
        	return True			
        	
	return False

WasProvided()
The process looks as follows:

Code: Select all

Every time an order is saved
  and owning profile is under 'Default\zTesting Only\zAutomation Testing'
  and Order.ReceivedDate is >= 02/26/2019
  and a code snippet evaluates to true
  then do the following:
     add a 1099 Reporting Test task
B_Hinote
Posts: 57
Joined: Tue Jan 08, 2019 7:20 pm

Re: SellerProceeds.Is1099Provided

Post by B_Hinote »

Just for a test, I tried hardcoding the Snippet to look specifically at the second seller, but this did not work either.

Code: Select all

from System import *
from SoftPro.ClientModel import *
from SoftPro.Select.Client import *

def WasProvided():
   	if Context.Sellers[1].Proceeds.Is1099Provided == True:
       	return True			
        	
	return False

WasProvided()
B_Hinote
Posts: 57
Joined: Tue Jan 08, 2019 7:20 pm

Re: SellerProceeds.Is1099Provided

Post by B_Hinote »

It is now working...
Thank you.
Post Reply