How to set profile when creating a order through API?

Discussions related to SoftPro Select Server development.

Moderator: Phil Barton

Post Reply
kqian
Posts: 68
Joined: Wed Feb 23, 2011 4:01 pm

How to set profile when creating a order through API?

Post by kqian »

How can I set the profile when creating an order? Thanks.
// Create the server object. Note the use of the constant to define custom login.
NetworkCredential credential = new NetworkCredential(@"<username>", @"<password>", SoftPro.Select.Client.Constants.SelectDomain);
SelectServer server = new SelectServer(null, new Uri(@"http://localHost:80/SelectServer"), credential);

// Create the order tracking client
SoftPro.OrderTracking.Client.OrderTracking ot = server.GetService<SoftPro.OrderTracking.Client.OrderTracking>();

// Create the specification for the new order number.
OrderCreationSpec spec = new OrderCreationSpec()
{
BaseOrderNumber = @"MyOrderNumber",
Prefix = @"Pre",
Suffix = @"Suf"
}

using ( IOrder order = ot.CreateOrder(spec) )
....
Hadi Chemaly

Re: How to set profile when creating a order through API?

Post by Hadi Chemaly »

The profile used is the one associated with the user with which the network credential instance is created.

Can you be more specific about what you are trying to achieve?
kqian
Posts: 68
Joined: Wed Feb 23, 2011 4:01 pm

Re: How to set profile when creating a order through API?

Post by kqian »

When creating a instance of "SelectServer", it has a "CurrentProfile" as readonly. I want to know how I can change the Profile dynamically to create order for different profile, let say the user account has multiple profiles associated.

I tried to subscribe the SelectServer.ChooseProfile event but the event was never raised.

Thanks.

Kevin
Hadi Chemaly

Re: How to set profile when creating a order through API?

Post by Hadi Chemaly »

The OrderCreationSpec class passed in as an argument to OrderTracking.CreateOrder(spec) lets you specify the OwningProfileID upon order creation. Equivalently, once an order is created, you can change its associated profile through the IOrder.OwningProfileID property.

Down the road, we plan to provide a ProfileManagement API with which you will be able to inspect the profiles associated with a trustee. For the time being, you can retrieve the profile IDs you need directly from the database.
roteague
Posts: 292
Joined: Thu Sep 25, 2008 4:49 pm
Location: Honolulu, Hawaii

Re: How to set profile when creating a order through API?

Post by roteague »

What about when templates are attached to a profile. We use unique profiles for each brach. Each of these profiles has unique templates associated with them. We would like to create an order using the API, assign it to a profile, and make sure that the templates are executed when the order is created.
Robert
Post Reply