Page 1 of 1

Add Requirements/Exceptions via. Automation and have the Order Context Resolve

Posted: Mon May 15, 2023 5:06 pm
by B_Hinote
I am not able to get the Field Codes to resolve in Requirements and Exceptions, when the Lookup Codes are added via Automation.

I am working on a project that requires various Requirement and Exception Codes to be added to the orders based on Specific Criteria. which I am able to do using the following Snippet Example.

Code: Select all

from System import *
from SoftPro.ClientModel import *
from SoftPro.Select.Client import *
from SoftPro.OrderTracking.Client.Orders import *
# Add Requirement "zReq1" if it does not exist. 
# Context = Order

def NeedsRequirements():
	HasREQ = False  #Set the overall Variable to False

	##Check to see if the Requirement Code Already Exists
	#for requirement in Context.Title.Commitments[0].Requirements:
	#	# If a Requirement Has no Code, go to the next one to evaluate
	#	if not requirement.Code:
	#		continue
	#	else:
	#		if requirement.Code.lower() == 'zreq1':
	#			HasREQ = True
	#			return

	# Run the AddRequirement Function if the Requirement Variable is False.			
	if HasREQ == False:
		AddRequirement('zReq1')

def AddRequirement(code):
	req = IOrder.CreateNew(Context, 'Requirement')
	req.Code = code
	requirements = Context.Title.Commitments[0].Requirements
	requirements.Add(req)

NeedsRequirements()
However, the results contain the Field Codes instead of the Order Content like it they do when added via. the Schedule B UI.

Why is this and what can I do to resolve this issue?
Requirement Example.jpg
Requirement Example.jpg (280.8 KiB) Viewed 14196 times

Re: Add Requirements/Exceptions via. Automation and have the Order Context Resolve

Posted: Wed May 17, 2023 1:50 pm
by BobRichards
You need to enter the Requirements (and Exceptions, if needed) as a formula. If you enter text in the "Edit Requirement and Exception" box then when the Code is entered, it treats the text as manually entered user text. Instead, put a formula in the requirement text box and enter your formula logic there. (Press F8 in the "Edit Requirement and Exception" to bring up the Formula Editor, enter the text then save it.)

Re: Add Requirements/Exceptions via. Automation and have the Order Context Resolve

Posted: Thu May 18, 2023 3:11 pm
by B_Hinote
Bob,

Thank you for your reply.

Concatenating the entire paragraph behind a Value Statement did allow the Requirement to be added programmatically. However, doing this takes away the simple formatting of the text that is available from the UI and turns the simple job of maintaining the Requirements and Exceptions into something that requires a substantially more experienced person to maintain. :-(
(See image below)

The Requirements, Exceptions & Documents All support the ability to resolve Field Codes from the UI Level and this functionality is the same for Documents when created via API, so is there a reason why SoftPro elected Not to Support the Requirements and Exceptions via API in the same way they do in the UI? Just curious.

Thank you again for the information provide.

Re: Add Requirements/Exceptions via. Automation and have the Order Context Resolve

Posted: Thu May 18, 2023 3:31 pm
by BobRichards
Sorry, I don't know why it was architected in this way. It has existed this way for so long without strong opposition that it is hard to say a change is needed - however good the reason. Ultimately it will boil down to the fact that the Select application provides additional functionality that was never added to the API.

If you feel strongly, you can always contact Select Customer Support express your opinion. There may be others that have expressed this same issue. I agree it is painful that the API doesn't support it. :(

Re: Add Requirements/Exceptions via. Automation and have the Order Context Resolve

Posted: Thu May 18, 2023 6:45 pm
by B_Hinote
Thanks again for your reply and do recognize you are just the messenger.

Do you know if there is a way to include basic RTF formatting in the formula so the results include basic things like Tab Alignment?

This can be done from the UI and when pulled from the Lookup Tables it is formatted accordingly.
I assume that the RTF code would have to be embedded in the formula, but I am not sure how to accomplish this and still have the Field Codes resolved.

Thank you again for you time.

Re: Add Requirements/Exceptions via. Automation and have the Order Context Resolve

Posted: Mon May 22, 2023 7:47 am
by BobRichards
Is there anything useful in the lookup tables with respect to formulas or special text? Can you send me an example?

Re: Add Requirements/Exceptions via. Automation and have the Order Context Resolve

Posted: Mon May 22, 2023 3:39 pm
by B_Hinote
After quite a bit of investigation and several tests, I was finally able to get something basic together that produced Tab Aligned Output.

Code: Select all

Value = "{\rtf1\ansi\ansicpg1252\deff0\nouicompat\deflang1033{\fonttbl{\f0\fnil\fcharset0 Arial;}} {\*\generator Riched20 10.0.19041}\viewkind4\uc1 \pard\sl240\slmult1\tx2880\fs20\lang9 "
Value = Value + "Instrument Type:\tab\ " + {{Order.Deeds[1].Type}} + "\par "
Value = Value + “Instrument Date:\tab\ " + {{Order.Deeds[1].Recording.Dated LD}} + "\par "
Value = Value + "Date/Type Recorded:\tab\ " + {{Order.Deeds[1].Recording.RecordedDate}} + "\par "
Value = Value + "\tab\ " + {{Order.Deeds[1].Recording.BookLabel}} + " " + {{Order.Deeds[1].Recording.BookNumber}} + ", " + {{Order.Deeds[1].Recording.PageLabel}} + " " + {{Order.Deeds[1].Recording.PageNumber}} + ", " + {{Order.Deeds[1].Recording.DocumentLabel}} + " " + {{Order.Deeds[1].Recording.DocumentNumber}} + "\par "
Value = Value + "Consideration Amount\tab\ $" + {{Order.Deeds[1].ConsiderationAmount}} + "\par "
Value = Value + "Grantor:\tab\ " + {{Order.Deeds[1].Grantor.Name}} + "\par "
Value = Value + "Grantee:\tab\ " + {{Order.Deeds[1].Grantee.Name}} + "\par "
Value = Value + "}"
I am not sure how far I might be able to extend this, but the major issue was formatting the content to align with tabs, so time will tell if this produces a consistent result or is a failure. :-)

Re: Add Requirements/Exceptions via. Automation and have the Order Context Resolve

Posted: Wed May 31, 2023 2:46 pm
by BobRichards
I'm glad you got it working and thanks for posting a solution.

Re: Add Requirements/Exceptions via. Automation and have the Order Context Resolve

Posted: Wed May 31, 2023 3:07 pm
by B_Hinote
I should point out that the example I provided only appears to work with SPS V4.6.

When I tried to use the same coding in SPS V4.3 it fails. I assume this is because the RTF version is not compatible with the V4.3 RTF Controls.

I asked SP for assistance in identifying what RTF Version the V4.3 Controls are using to see if there is something more universal that will work with both or will make it compatible with V4.3, but have not received a reply yet.