7/6/2025 8:29:20 AM
|
|
slxdeveloper.com Community Forums |
|
|
|
The Forums on slxdeveloper.com are now retired. The forum archive will remain available for the time being. Thank you for your participation on slxdeveloper.com!
Forum to discuss the use of the SalesLogix Web Platform, Client and Customer Portals, and the Application Architect (For version 7.2 and higher only). View the code of conduct for posting guidelines.
|
|
|
|
Build Error while trying to override a BusinessRule in Sage.SalesLogix.BusinessRules.dll
Posted: 21 May 09 10:10 AM
|
Hi,
I am new to SalesLogix web and I need to override a business rule in Ticket. My users do not want to use "CLOSED" status for a Ticket and they prefer "RESOLVED" instead. By analyzing the Sage.SalesLogix.BusinessRules.dll using Reflector, I could realize that things won't work if I simply change the PickList value to "Resolved" - I could see that the DLL is checking against a hardcoded "CLOSED" status at some places. For example, the CloseTicket() rule is as follows:
public static void CloseTicket(ITicket ticket) { IUserService service = ApplicationContext.Current.Services.Get(true); if (service is WebPortalUserService) { WebPortalUserService service2 = (WebPortalUserService) service; ITicketHistory item = EntityFactory.Create(); string id = service2.GetUser().Id; item.Note = string.Format(Resources.CloseNoteForTicket, ticket.AlternateKeySuffix); item.NewValue = Resources.CloseStatus; item.FieldName = "Statuscode"; item.OldValue = Resources.OpenStatus; item.CreateUser = id; item.ModifyUser = id; item.Ticket = ticket; ticket.TicketHistory.Add(item); ticket.StatusCode = BusinessRuleHelper.GetPickListItemIdByName("Ticket Status", "CLOSED"); ticket.CompletedDate = new DateTime?(DateTime.UtcNow); ticket.CompletedBy = service2.GetUser().DefaultOwner; ticket.Closed = true; ticket.Save(); } }
There are even more instances like this. What I could learn from the experts was to disable this rule (by unchecking the "Active" checkbox in "Entity Model->Packages->SalesLogix Application Entities->Ticket->Rules->Business Rule Methods->CloseTicket") and add another primary step (CloseTicketStep) and make it active. I then copied all the above code to this method. It gave me a bunch of compilation errors and following a great thread by Ryan Farley and Mike Boysen (http://www.slxdeveloper.com/forum.aspx?forumid=4002&postid=14448) I could solve most of them. Now I am stuck at another problem - inaccessible class members due to protection level. My new method is something like this:
#region Usings using System; using Sage.Entity.Interfaces; using Sage.Form.Interfaces; using Sage.Platform.Security; using Sage.SalesLogix.Ticket; using Sage.SalesLogix; using Sage.SalesLogix.BusinessRules; using Sage.SalesLogix.BusinessRules.Properties; #endregion Usings
namespace Sage.BusinessRules.CodeSnippets { public static partial class TicketBusinessRules { public static void CloseTicketStep(ITicket ticket) { IUserService service = Sage.Platform.Application.ApplicationContext.Current.Services.Get(true); if (service is Sage.SalesLogix.Web.WebPortalUserService) { Sage.SalesLogix.Web.WebPortalUserService service2 = (Sage.SalesLogix.Web.WebPortalUserService)service; Sage.Entity.Interfaces.ITicketHistory item = Sage.Platform.EntityFactory.Create(); string id = service2.GetUser().Id; item.Note = string.Format(Sage.SalesLogix.BusinessRules.Properties.Resources.CloseNoteForTicket, ticket.AlternateKeySuffix); item.NewValue = Resources.CloseStatus; item.FieldName = "Statuscode"; item.OldValue = Resources.OpenStatus; item.CreateUser = id; item.ModifyUser = id; item.Ticket = ticket; ticket.TicketHistory.Add(item); ticket.StatusCode = BusinessRuleHelper.GetPickListItemIdByName("Ticket Status", "RESOLVED"); ticket.CompletedDate = new DateTime?(DateTime.UtcNow); ticket.CompletedBy = service2.GetUser().DefaultOwner; ticket.Closed = true; ticket.Save(); } } } }
Now I get the following errors (listing a few for brevity):
ERROR - C:\Documents and Settings\jmathew\Application Data\Sage\Platform\Output\Sage.SnippetLibrary.CSharp\src\Sage.SnippetLibrary.CSharp.@.600cca35-3359-473b-a111-19803a0b6f4c.codesnippet.cs(47,72):'Sage.SalesLogix.BusinessRules.Properties.Resources' is inaccessible due to its protection level ERROR - C:\Documents and Settings\jmathew\Application Data\Sage\Platform\Output\Sage.SnippetLibrary.CSharp\src\Sage.SnippetLibrary.CSharp.@.600cca35-3359-473b-a111-19803a0b6f4c.codesnippet.cs(47,82):'Sage.SalesLogix.BusinessRules.Properties.Resources' does not contain a definition for 'CloseNoteForTicket'
ERROR - C:\Documents and Settings\jmathew\Application Data\Sage\Platform\Output\Sage.SnippetLibrary.CSharp\src\Sage.SnippetLibrary.CSharp.@.600cca35-3359-473b-a111-19803a0b6f4c.codesnippet.cs(55,25):'Sage.SalesLogix.BusinessRules.BusinessRuleHelper' is inaccessible due to its protection level ERROR - C:\Documents and Settings\jmathew\Application Data\Sage\Platform\Output\Sage.SnippetLibrary.CSharp\src\Sage.SnippetLibrary.CSharp.@.600cca35-3359-473b-a111-19803a0b6f4c.codesnippet.cs(55,44):'Sage.SalesLogix.BusinessRules.BusinessRuleHelper' does not contain a definition for 'GetPickListItemIdByName'
I can see that the classes Resources and BusinessRuleHelper are internal to Sage.SalesLogix.BusinessRules
internal class Resources Name: Sage.SalesLogix.BusinessRules.Properties.Resources Assembly: Sage.SalesLogix.BusinessRules, Version=7.5.1.1742
--------------------------------------- internal class BusinessRuleHelper
Name: Sage.SalesLogix.BusinessRules.BusinessRuleHelper Assembly: Sage.SalesLogix.BusinessRules, Version=7.5.1.1742 ---------------------------------------
Can anyone please help me how to proceed from this point? Or is there a better way I can implement the same functionality?
Thanks in advance Johnson Mathew |
|
|
| |
|
You can
subscribe to receive a daily forum digest in your
user profile. View the site code
of conduct for posting guidelines.
Forum RSS Feed - Subscribe to the forum RSS feed to keep on top of the latest forum activity!
|
|
|
|
|
|
|
|