Page 1 of 1

Create Order With Multiple Templates

Posted: Thu Jul 01, 2021 3:45 pm
by uwdoug79
I have code that applies a template when creating an order in the API. Is it possible to add multiple templates to be applied to the order when created. I need to apply a default template to each order besides the unique one that gets picked when my users select a certain order type.

Code: Select all

                                
                                if (oTemplate.SpstTempateDescription == "N/A")
                                {
                                    specTemplate.Templates.Add("CTWI TO REFI");
                                }
                                else
                                {
                                    switch (Convert.ToInt32(dt.Rows[i].ItemArray[62]))
                                    {
                                        case vCDF:
                                            specTemplate.Templates.Add(oTemplate.SpstTempateDescription.Trim() + " CDF");
                                            blnCDF = true;
                                            break;
                                        default:
                                            specTemplate.Templates.Add(oTemplate.SpstTempateDescription);
                                            blnCDF = false;
                                            break;
                                    }
                                }
                               specTemplate.Templates.Add("Default Template");
                                
 

Re: Create Order With Multiple Templates

Posted: Fri Jul 02, 2021 12:09 pm
by BobRichards
Yes. The OrderCreationSpec.Templates property will hold a list of templates. Just Add them to this list in the order you want them applied to the newly created order. If you only specify the templates, the order number/prefix/suffix will automatically fill themselves out if possible.

Code: Select all

OrderCreationSpec specTemplate= new OrderCreationSpec();
specTemplate.Templates.Add("Default Template");
specTemplate.Templates.Add("Additional Template1");
specTemplate.Templates.Add("Additional Template2");