Policy Schedules B1,B2 - Sample code needed
-
- Posts: 92
- Joined: Tue Feb 04, 2014 3:34 pm
Policy Schedules B1,B2 - Sample code needed
I'm trying to accomplish the following in code and would appreciate any sample code:
Click Start Policy
Merge - OK
Click Import Exceptions or Subordinate Matters
Select all items - Click ok
Thanks,
Peter
Click Start Policy
Merge - OK
Click Import Exceptions or Subordinate Matters
Select all items - Click ok
Thanks,
Peter
-
- Posts: 61
- Joined: Fri Jul 01, 2011 10:06 am
- Location: Raleigh, North Carolina
- Contact:
Re: Policy Schedules B1,B2 - Sample code needed
This is how to do the Start Policy - Merge programmatically:
My initial impression of the import dialog is that it is simply copying one tree of data into another tree of data, so you will likely want to walk the trees of objects and insert them appropriate, potentially through a recursive function. However, this code base does not translate cleanly to your use case since the current implementation is tied heavily to the UI. I may need to refer you to a developer familiar with the area if you need to replicate the behavior precisely.
Below is how to create a single exception and copy the data from another phrase into it:
Code: Select all
IOrderItem policy = /* Some logic to get the policy you want to merge into */
if (policy.GetType().GetMethod("MergeExceptions", BindingFlags.Public | BindingFlags.Instance) != null)
{
using (SoftPro.Select.Client.Lookups.LookupSuppressionBlock.Suppress())
{
policy.Invoke("MergeExceptions");
}
}
My initial impression of the import dialog is that it is simply copying one tree of data into another tree of data, so you will likely want to walk the trees of objects and insert them appropriate, potentially through a recursive function. However, this code base does not translate cleanly to your use case since the current implementation is tied heavily to the UI. I may need to refer you to a developer familiar with the area if you need to replicate the behavior precisely.
Below is how to create a single exception and copy the data from another phrase into it:
Code: Select all
IOrderItem sourceException = /* Some logic to get the source exception */
IOrderItem policy = /* Some logic to get the policy you want to import into */
IOrderItem newException = policy.Order.CreateNew("Exception");
using (SoftPro.Select.Client.Lookups.LookupSuppressionBlock.Suppress())
{
newException = (IOrderItem)sourceException.Invoke("CreateCopy", newException, false, false);
sourceException.Invoke("CopyIncludeOnValues", newException);
}
IList destinationExceptions = (IList)policy["Exceptions"];
destinationExceptions.Add(newException);
Graham Campbell
SoftPro Software Engineer
SoftPro Software Engineer
-
- Posts: 92
- Joined: Tue Feb 04, 2014 3:34 pm
Re: Policy Schedules B1,B2 - Sample code needed
Thanks for the code Graham!
I can get the policy. How do I get the exceptions to import as is done in the UI?
We do have a tight deadline to load test Cameron for North Carolina and we were given the workflow to reproduce exactly so if you can forward this request to the developer that is familiar with this area that would be great.
Thanks,
Peter
I can get the policy. How do I get the exceptions to import as is done in the UI?
We do have a tight deadline to load test Cameron for North Carolina and we were given the workflow to reproduce exactly so if you can forward this request to the developer that is familiar with this area that would be great.
Thanks,
Peter
-
- Posts: 91
- Joined: Wed Sep 10, 2008 3:33 pm
- Location: Raleigh, NC
- Contact:
Re: Policy Schedules B1,B2 - Sample code needed
Peter, I don't think this is a valid use case. When the user clicks Start Policy, it brings all exceptions from the commitment over to the policy. If you then used the Import feature to select all, you'd bring duplicates of each of those exceptions over to the policy. The Start Policy use case is the typical one, and users would only click "Import" for one-off exceptions that need to be pulled from another policy.
Graham can still help with the code, but I'd suggest focusing on the Start Policy piece.
Graham can still help with the code, but I'd suggest focusing on the Start Policy piece.
Melissa McBerkowitz
VP of Product Strategy, SoftPro
VP of Product Strategy, SoftPro
-
- Posts: 61
- Joined: Fri Jul 01, 2011 10:06 am
- Location: Raleigh, North Carolina
- Contact:
Re: Policy Schedules B1,B2 - Sample code needed
Given Melissa's response, I will wait for clarification on what is required here. I agree that the use case being described would generate two copies of each exception, which is likely not desired.
Graham Campbell
SoftPro Software Engineer
SoftPro Software Engineer
-
- Posts: 92
- Joined: Tue Feb 04, 2014 3:34 pm
Re: Policy Schedules B1,B2 - Sample code needed
Ok, we got clarification on the use cases which changes things significantly and avoids the duplicate exceptions.
1) Go to Commitment Schedule B1,B2
2) Double Click Exceptions-> Tax58
3) Replace "Taxes or assessments for the year _____, and subsequent years, not yet due or payable." with "Taxes or assessments for the year 2015, and subsequent years, not yet due or payable." and Click OK
4) Go to Policy Schedules B1,B2
5) Click Start Policy, select Overwrite and then click OK
Thanks,
Peter
1) Go to Commitment Schedule B1,B2
2) Double Click Exceptions-> Tax58
3) Replace "Taxes or assessments for the year _____, and subsequent years, not yet due or payable." with "Taxes or assessments for the year 2015, and subsequent years, not yet due or payable." and Click OK
4) Go to Policy Schedules B1,B2
5) Click Start Policy, select Overwrite and then click OK
Thanks,
Peter
-
- Posts: 92
- Joined: Tue Feb 04, 2014 3:34 pm
Re: Policy Schedules B1,B2 - Sample code needed
I was already given the code for steps 4 and 5. Do I just replace "MergeExceptions" with "OverwriteExceptions"?
IOrderItem policy = /* Some logic to get the policy you want to merge into */
if (policy.GetType().GetMethod("MergeExceptions", BindingFlags.Public | BindingFlags.Instance) != null)
{
using (SoftPro.Select.Client.Lookups.LookupSuppressionBlock.Suppress())
{
policy.Invoke("MergeExceptions");
}
}
IOrderItem policy = /* Some logic to get the policy you want to merge into */
if (policy.GetType().GetMethod("MergeExceptions", BindingFlags.Public | BindingFlags.Instance) != null)
{
using (SoftPro.Select.Client.Lookups.LookupSuppressionBlock.Suppress())
{
policy.Invoke("MergeExceptions");
}
}
-
- Posts: 61
- Joined: Fri Jul 01, 2011 10:06 am
- Location: Raleigh, North Carolina
- Contact:
Re: Policy Schedules B1,B2 - Sample code needed
When the Overwrite was created, the developers simply cleared the list and then invoked the Append functionality.
As such, this is how we invoke an Overwrite:
I think that this method existed in the original implementation, so you likely don't need to check for the method existence. However, it wouldn't hurt to check if you prefer to.
As such, this is how we invoke an Overwrite:
Code: Select all
IOrderItem policy = /* Some logic to get the policy you want to merge into */
using (SoftPro.Select.Client.Lookups.LookupSuppressionBlock.Suppress())
{
var existingExceptions = (IList)policy["Exceptions"];
existingExceptions.Clear();
policy.Invoke("ImportExceptions");
}
Graham Campbell
SoftPro Software Engineer
SoftPro Software Engineer
-
- Posts: 92
- Joined: Tue Feb 04, 2014 3:34 pm
Re: Policy Schedules B1,B2 - Sample code needed
That worked. Thanks for your help!