Skip to content

Instantly share code, notes, and snippets.

@awrowse
Created May 12, 2014 18:09
Show Gist options
  • Save awrowse/c41c69ec29db121a86b5 to your computer and use it in GitHub Desktop.
Save awrowse/c41c69ec29db121a86b5 to your computer and use it in GitHub Desktop.
Opp Open via Report Command
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using RightNow.AddIns.AddInViews;
using System.Drawing;
using System.AddIn;
namespace OppOpen
{
[AddIn("Opp Open", Version="1.0.0.0")]
public class Launcher : IReportCommand2
{
public IList<string> CustomObjectRecordTypes
{
get { return new List<string>() { }; }
}
public bool Enabled(IList<IReportRow> rows)
{
return true;
}
public void Execute(IList<IReportRow> rows)
{
if(rows != null && rows.First() != null & rows.First().Cells != null && rows.First().Cells.Count > 0 )
{
gContext.AutomationContext.EditWorkspaceRecord(RightNow.AddIns.Common.WorkspaceRecordType.Opportunity, Convert.ToInt64(rows.First().Cells.First().Value));
}
}
public System.Drawing.Image Image16
{
get { return null; }
}
public System.Drawing.Image Image32
{
get { return null; }
}
public IList<RightNow.AddIns.Common.ReportRecordIdType> RecordTypes
{
get
{
return new List<RightNow.AddIns.Common.ReportRecordIdType>()
{
RightNow.AddIns.Common.ReportRecordIdType.Opportunity,
RightNow.AddIns.Common.ReportRecordIdType.None
};
}
}
public string Text
{
get { return "Opp Open"; }
}
public string Tooltip
{
get { return "Open Opp"; }
}
public bool Initialize(IGlobalContext context)
{
gContext = context;
return true;
}
public IGlobalContext gContext { get; set; }
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment