Calling CRM Actions

Hints, Tips and Tricks

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

Calling CRM Actions

  • Comments 2
  • Likes
The CRM.URL() method is used to allow you to build correctly formatted URLs that reach back into the application. 

Most commonly this is used to interact with ASP pages and with Sage CRM .NET application extensions.

For example to build a button that calls an ASP page the code would look like:

var strCallASPButton = CRM.Button("ASP","save.gif", CRM.Url("myPage.asp"));

or to redirect an ASP page to another ASP page that needs to instantiate the eWare object the code would look like:

Response.Redirect(CRM.URL("mypage.asp"));

For example to redirect an ASP page to a system screen you could use:

Response.Redirect(CRM.URL(130));

or to create a button that references the same action it would look like:

var strFindCompanyButton = CRM.Button("search","search.gif", CRM.Url(130));

Knowing what codes can be used can be something of a mystery and I have been asked whether there is any documentation available for these actions. But the ability to call the CRM actions is not an official API, so can not be officially supported. In many instances however, it is useful that we can redirect to specific places in the CRM screens.

What you may not know is that you do not have to use the action codes, but you can use the action names. The usage of the action names helps solve the problem of not knowing which action code to use. It is vital however that you note that this does not change the fundamental issue of the fact that this is still an unsupported way of invoking CRM behaviour. But we can cheat.

So to call the OpportunityList action we could either call

Response.Redirect(CRM.URL(185));

or

Response.Redirect(CRM.URL("caselist"));

Note:
The concept of managing context has been discussed in the article "Changing Context when jumping between pages using the COM ASP API".

The list of actions that can be used is held in the translation area and are part of the Caption Family 'actionnames'.

Administration -> Customization -> Translations

You can search for translations belonging to the caption family "actionnames".

  
Because these translations represent the actions that can be called from TabGroups and ButtonGroups many of these are documented as to their effect within the System Administration guide.

Note:

I must stress again that the usage of these actions within the CRM.URL() is not an official method to call behaviour and is therefore unsupported.
Comments
  • Jeff,

    I know this is a very old post but I'm hoping you'll still be able to respond. I created a custom Company Summary screen and I'm trying to add the Maintain Relationship button and the Customer Maintenance button to the screen. I tried using the suggestions on this post and put the following in my script and then added the button to the screen.

    var strMainRelButton = eWare.Button("Maintain Relationship","maintainrelationship.gif", eWare.Url("MaintainRelationship"));

    However, when I click the button, it tries to find a CustomPages file so, naturally, it throws a "404 - File or directory not found." error. It also doesn't seem to be resolving the .gif either because it just has a default icon, but that's the least of my concerns right now. I have had success adding other buttons to the screen successfully such as the New Task where I used:

    var strNewTaskButton = eWare.Button("newtask","newtask.gif", eWare.Url(361));

    Unfortunately, I don't know the codes for the buttons I'm trying to add so I was excited to find this post which gave the alternative. But, my excitement was quickly squashed. I have spent days searching the Internet but can't find anything helpful.

    Any ideas why I cannot get this to work? This is on Sage CRM 7.2.b

    Thanks,

    Dennis

  • Dennis

    Is maintain relationship a called to another CRM page (is it a system action) or is it a call to another ASP page or to behaviour that pops up some ERP behaviour?  Are you integrated with Sage 100 or Sage 300?