Showing results for 
Search instead for 
Do you mean 
Community Home Request Access Read Blogs Share Your Ideas Search Community View My Settings
Reply
Highlighted
Copper Contributor
Posts: 18
Registered: ‎12-08-2009

Insert Opportunity - including sales process

Include the following code.

 

OnForm Load:

 

NHibernate.ISession _session = new Sage.Platform.Orm.SessionScopeWrapper();
NHibernate.IQuery _query = _session.CreateSQLQuery("select PLUGINID,NAME FROM PLUGIN where TYPE=1 AND USERID<>'ADMIN'");
var _salesprocess = _query.List<object[]>();

foreach (var item in _salesprocess)
{
comboboxSalesProcess.Items.Add(new ListItem(item[1].ToString(), item[0].ToString()));

}

 

cmdSave:

 

string _oppId = string.Format("{0}", (BindingSource.Current as Sage.Platform.ComponentModel.IComponentReference).Id);
string _spId = this.cbbProcessoVenda.SelectedValue.ToString();
Sage.Entity.Interfaces.ISalesProcesses _newSP = Sage.Platform.EntityFactory.Create<Sage.Entity.Interfaces.ISalesProcesses>();
_newSP.InitSalesProcess(_spId, _oppId);
_newSP.Save();

 

Enjoy!