Importance of prevURL Property Part-2

By | August 24, 2011

In my previous post I had brief discussion on importance of prevURL property in the query string and explained how to use it with list asp page.

http://sagecrmaddons.blogspot.com/2010/11/importance-of-prevurl-property.html

In this blog I will be exploring it in more detail and will give idea of how and where it should be used while dealing with custom ASP pages.

In CRM user always jumps from standard screens to custom asp pages/ .net dll pages and vice versa. When we redirect from custom ASP page to any standard screen and try to use standard Save or Cancel button we gets redirected to the corresponding standard screen (list/screen) as per the standard instead of our custom asp page. We can handle this scenario by using prevURL attribute and its query string variables.

Recently I had a look at the Sage CRM forum and there were queries were

1. There is a custom entity say Jobs with summary page designed in custom asp page.

2. The Jobs summary has a button say “Show Document” which shows the relevant standard library summary screen.

3. Now redirecting from Job summary to library summary part was working fine. But whenever user clicks on the Save/ Cancel button it gets to the standard library list (which is CRM standard behavior). It should be redirected to the Job summary.

To handle this situation you need to play with previous URL and its “J” and “F” parameters. The HREF property of button which forwards user to library screen should be configured properly. It should contain the prevURL variable in it consisting of J (jump) and F (from) parameters.

The code which can control the above functionality is something like below:

lcPreURL=eWare.URL(“Jobs/JobsSummary.asp”)

lcPreURL=lcPreURL.split(“&”);

lcPreURL=lcPreURL[0]+”%26Key0=58%26Key37=”+UseId+”%26Key50=648%26Key58=”+UseId+”%26J=Jobs/JobsSummary.asp%26jobs_JobsID=”+UseId+”%26T=Jobs”

var strURL = new String(eWare.URL(341));

strURL=strURL.split(“&”);

strURL=strURL[0]+”&Act=341&Mode=1&CLk=T”

+”&Key0=58″

+”&Key5=” + eWare.GetContextInfo(“user”,”user_primarychannelid”)

+”&Key15=”+ library.libr_libraryId +”&Libr_LibraryId=”+ library.libr_libraryId

+”&Key37=” + UseId

+”&Key58=” + UseId + “&jobs_JobsID=”+UseId

+”&Key-1=58″

+”&PrevCustomURL=”+lcPreURL

//’ Add Button

Container.AddButton(CRM.Button(“Show Document”,”edit.gif”,strURL, “Jobs”, “EDIT”));

I checked this code with pages that are created using CRM entity wizard component. Here UseId is nothing but your custom entity id where as ‘library’ refers to the library record. Action 341 specifies the standard Library summary screen.

I came across many queries where the users tend to have issues in navigating from custom screen to another. So I thought I will put down a small snippet of what you need to take care when you handle the navigation. I used the technical expertise of my team to write this topic so there are a lot of technical “gongs” and “tongs” in this blog so the technical guys may find themselves in a familiar territory. But if you tend to get lost in the later part of blog, just don’t worry. Turn around and you will see me looking just as lost as you :).


If you find this content useful, please drop us an email at crm@greytrix.com.