in Search

Hints, Tips and Tricks

Technical Hints Tips and Tricks that cover customization and development using Sage CRM. API usage and coding are covered.

Manage Escalations

A new example component has been added to the resources section for development partners to download.  The purpose of this component is to make the management of escalation rules easier in implementation of Sage CRM where there are a large number of rules to manage.  When working with large number of Escalation rules - for example in a system with more than 40 rules it can be time consuming to find the correct rule when editing. This component enhances the existing display of Escalation rules by

1) Adding Table name and View name to the list of escalations.
2) Allowing list to be sorted Alphabetically (asc & desc)
3) Sorting by Table or View
4) It also provided a Filterbox.

The new screen is found under

Administration -> Advanced Customization

The new screen that is produced allows the Administrator to search and access rules quickly.

The Code

The simplified code for the page is here:

<!-- #include file ="accpaccrm.js"-->
<script>
window.attachEvent("onload",correctURL);
function correctURL()
{
// hide the button
re = /key0/gi;
for(i=0;i<document.all.length;i++)
{
if(document.all[i].tagName=='A' )
{
if(document.all[i].href.search(/Act=415/i)>-1)
{
var strURL = document.all[i].href;
document.all[i].href = document.all[i].href.replace(re,"key27");
}

}
}
}
</script>

<%
if (CRM.Mode==View)
{
CRM.Mode=Edit;
}

//Build the search block
var SearchBlock = CRM.GetBlock("entrygroup");
var rulename = CRM.GetBlock("entry");
with (rulename)
{
FieldName = "wkrl_caption";
Caption = CRM.GetTrans("colnames","wkrl_caption")+":";
EntryType = 10;
Size = 40;
}

var tablename = CRM.GetBlock("entry");
with (tablename)
{
FieldName = "wkrl_entity";
Caption = CRM.GetTrans("colnames","wkrl_entity")+":";
EntryType = 10;
Size = 40;
}

with (SearchBlock)
{
AddBlock(rulename);
AddBlock(tablename);
Title = CRM.GetTrans("tabnames","search");
}

//Build the List Block
var ListBlock = CRM.GetBlock("List");
with (ListBlock)
{
CaptionFamily = "eworkflowrule";
SelectSQL = "select * from vWorkflowRules"
var entityGridColBlock = AddGridCol("wkrl_entity");
var tableGridColBlock = AddGridCol("wkrl_table");
var captionGridColBlock = AddGridCol("wkrl_caption");
var enabledGridColBlock = AddGridCol("wkrl_enabled");
var intervalGridColBlock = AddGridCol("wkrl_runinterval");
}

//Set EntryBlock properties for an EntryGroup Block using an Enumerator
var myE = new Enumerator(ListBlock);
while (!myE.atEnd())
{
myEntryBlock = myE.item();
myEntryBlock.AllowOrderBy = true;
myE.moveNext();
}

//Set GridColBlock properties
with (captionGridColBlock)
{
JumpAction= 415;
CustomIdField = "wkrl_ruleid";
}

var strAddEscalation = CRM.Button("new","newescalationrule.gif", CRM.Url(130));

var myBlockContainer = CRM.GetBlock("Container");
with (myBlockContainer)
{
AddBlock(SearchBlock);
AddBlock(ListBlock);
AddButton(strAddEscalation);

ButtonTitle = "search";
ButtonImage = "search.gif";
}
ListBlock.ArgObj = SearchBlock;

var Arg =  "wkrl_ruletype = 'time'";
CRM.AddContent(myBlockContainer.Execute(Arg));
Response.Write(CRM.GetPage("manageEscalation"));

%>

The page is a fairly straight forward search page. But as the screen is based on an administration table rather than an application table like 'company or 'opportunity' there are number of points to make here

1)  The Search Block has been manually built rather than being defined in meta data because the workrules table which holds the definitions of the escalation rules is not exposed in the administration screens.  There is an article that discusses building screens not bound to meta data here: Building a Screen not bound to Meta Data using the ASP COM API

2) The List Block like the Search Block has been built with out reference to meta data.  See the article "Building Lists without reference to Meta Data in the ASP COM API". There was a small problem with adding the hyperlink to the edit screen as the APIs are generally more suited to managing the context within the main application screens rather that the administration screens.  To correct the hyperlink some code was added to execute within the browser to make the correction needed.

3) The clientside code used to make the URL correction is based on the code discussed in the article "Using Clientside Code to Change the Property and Behaviour of a Column in a List".

Development Partners can download the component that will install this page from the resources section of this website.  Click here to download now.

Comments

No Comments

About Jeff Richards

As the Head of Training Program Development for Sage Technologies, I am responsible for providing the technical education for the Sage CRM Development Partner community. I write and present regularly on Sage CRM development techniques, hints and tips. I also provide education and training for the staff of local Sage companies in new technical features and act as a resource for Sage trainers as they develop their training courses. I have been working with Sage CRM since early 2001 (version 2.85) and I have a thorough understanding of the issues faced by partners carrying out implementations. I have been working within the Software Industry since 1993. I have a strong background in Business Rules and Workflow.

News

To help you find information quickly, use the tag cloud on the righthand side of the page. Every article and file posted is marked with one or more tags. The tags are mainly single words and are listed alphabetically. The more frequently a tag has been used to mark an article the bigger it will appear in the cloud. The tags are hyperlinks that lead to a collection of items that are associated with a tag. To find an article that discusses creating XML feeds using ASP pages, click on ASP, then on the next page click on XML.

This Blog

Syndication

sagecrm.com Articles