Template in API Development

Discussions related to custom development with Select.
Post Reply
sanjay.mittal
Posts: 94
Joined: Mon Dec 28, 2009 3:43 pm

Template in API Development

Post by sanjay.mittal »

Can you please tell me how can I use the default template for a user's default office when create orders through API? I couldn't find anything in the documentation.
Mark McKenna

Re: Template in API Development

Post by Mark McKenna »

Hi Sanjay,

To apply a template at order creation time, you will want to utilize the OrderCreationSpec type. It has a Templates property that exposes a collection of template numbers to apply when the order is created, in the order provided. The Select SDK help file has additional information about this type.

Usage:

Code: Select all

...
// Get the Order Tracking service
SoftPro.OrderTracking.Client.OrderTracking ot = server.GetService<SoftPro.OrderTracking.Client.OrderTracking>( );

// Create the spec
OrderCreationSpec spec = new OrderCreationSpec( );
spec.Templates.Add( "Template1235" );

// Create the order
using ( IOrder order = ot.CreateOrder(spec) )
{
    ...
    ot.CloseOrder( order );
}
sanjay.mittal
Posts: 94
Joined: Mon Dec 28, 2009 3:43 pm

Re: Template in API Development

Post by sanjay.mittal »

Thanks Mark.

Can you also tell me how to get the default template name from a user's default office?

Best
Sanjay
Mark McKenna

Re: Template in API Development

Post by Mark McKenna »

Unfortunately, the information you are trying to acquire is not currently exposed by the Select API and would require non-trivial database interaction, which is not something we generally recommend. I will email you directly to discuss your options further.
Mark McKenna

Re: Template in API Development

Post by Mark McKenna »

For those customers that are using, at minimum, Select version 2.6, note the following related API functionality that is available. Be sure and check out the ProfileManagement features in the Select SDK Help file.

Code: Select all

SelectServer sps = GetService<SelectServer>();
IProfile profile = sps.CurrentProfile;
IProfileItem profileItem = profile.Items.FirstOrDefault(pi => pi.Name == "DefaultTemplate" && pi.Category == "PFDefault");
object defaultTemplateID = profileItem.CurrentValue; // guid, if defined
roteague
Posts: 292
Joined: Thu Sep 25, 2008 4:49 pm
Location: Honolulu, Hawaii

Re: Template in API Development

Post by roteague »

Where can I find a list the templates? Are they stored in a lookup table?
Robert
Mark McKenna

Re: Template in API Development

Post by Mark McKenna »

Templates are persisted alongside Orders with the IsTemplate flag turned on.
Post Reply