Applying a Template via Integration errors

Discussions related to custom development with Select.
Post Reply
enendza
Posts: 75
Joined: Wed Oct 16, 2019 12:22 pm

Applying a Template via Integration errors

Post by enendza »

Hi -

When applying a template to an order via an Integration, when I ApplyChanges() to the order I get the message "The order has unresolved errors. Any outstanding errors must be resolved"

When I run the same example in SoftPro UI I see these errors - see attachment -
  • How do I force a save ignoring errors in the API
    OR
    How do I set these values in the Template?
Your help as always is appreciated :-)

Emma Nendza
Attachments
TemplateFees.png
TemplateFees.png (14.44 KiB) Viewed 2450 times
BobRichards
Posts: 1377
Joined: Wed Jan 15, 2014 3:50 pm
Location: Raleigh, NC
Contact:

Re: Applying a Template via Integration errors

Post by BobRichards »

How do I force a save ignoring errors in the API?

You can't. It is a feature that orders with errors cannot be saved.

How do I set these values in the Template?

You need to open the Template file and make the changes that are required? Templates do not have the same error checking mechanisms as orders because they may hold incomplete information. An error free template does not guarantee an error free order.
Bob Richards, Senior Software Developer, SoftPro
enendza
Posts: 75
Joined: Wed Oct 16, 2019 12:22 pm

Re: Applying a Template via Integration errors

Post by enendza »

OK - I can do that .. with your help :-) How do I open a template?

Are templates custom to our configuration? I am looking for a way to set the values and any support is helpful. Is there some sample code that I can review.

Thanks in advance.
Emma
BobRichards
Posts: 1377
Joined: Wed Jan 15, 2014 3:50 pm
Location: Raleigh, NC
Contact:

Re: Applying a Template via Integration errors

Post by BobRichards »

Treat a template just like an order in your code or in the Select client GUI.

In C#, you would use the same code that is used to open the order. For instance if the template's name is "TemplateXYZ", you can search the order store for the matching number. This is the same way you look for orders.

Code: Select all

 // Search orders for matching order number.
IOrderStore os = ss.GetService<IOrderStore>();
IOrderInfo search = os.Orders.Where(t => t.Number == "TemplateXYZ").FirstOrDefault();
...
It may be quicker to do it in the Select client by opening the template directly.
  • Open Select and click the ProForm tab in the ribbon control then click "Order Search".
  • Enter the template name in the "Order #" field, make sure in the "Search for" area that "Templates" checkbox is checked.
  • Click "Search" at the bottom of the page.
Bob Richards, Senior Software Developer, SoftPro
enendza
Posts: 75
Joined: Wed Oct 16, 2019 12:22 pm

Re: Applying a Template via Integration errors

Post by enendza »

OK here is what I have in the code to Apply The Template to the new order that we are creating in our unattended process.

using (IOrder template = os.OpenOrder(info, OrderEditMode.ReadOnly))
{
iOrder.ApplyTemplate(template);
}


Should I edit the template before I apply it to the order?
How do I get the fields that I need to set on the Template?

Here is what the template looks like that I need to fill in the Payee info for each line
Attachments
Purchase CD Fees Screen.png
Purchase CD Fees Screen.png (300.23 KiB) Viewed 2442 times
enendza
Posts: 75
Joined: Wed Oct 16, 2019 12:22 pm

Re: Applying a Template via Integration errors

Post by enendza »

I saw your response to a similar question and it referred the user to a document - specifically it said this ..

"Best Practices for accessing IOrderItem properties. Didn't know if you would be interested: How to Read from IOrderItem Properties and How to Write to IOrderItem Properties."

Sounds like that document would be helpful to me also. However, the links don't work. Can you send me to the correct link?

Thanks

Emma
BobRichards
Posts: 1377
Joined: Wed Jan 15, 2014 3:50 pm
Location: Raleigh, NC
Contact:

Re: Applying a Template via Integration errors

Post by BobRichards »

It is not a document, per se. They are two posts about using the IOrderItem interface on order model properties. These are how you get/set the property values.

How to Read from IOrderItem Properties
How to Write to IOrderItem Properties
Bob Richards, Senior Software Developer, SoftPro
Post Reply