Showing results for 
Search instead for 
Do you mean 
Community Home Request Access Read Blogs Share Your Ideas Search Community View My Settings
Reply
New Member
Posts: 2
Registered: ‎08-11-2014

SLX 7.5.4 Group Selections In Common Tasks

Hi all,

 

I am struggling with adding a set of common tasks onto a custom main entity in SLX web 7.5.4. I have followed the guidance in Kris Halsrud's blog here:

 

http://customerfx.com/pages/integrationblog/2010/12/16/saleslogix-web-client-determining-the-selecte...

 

I have also added some additional tasks and entries to the same common functions via the details page section. When I run the tasks via the detail page using IEntityHistoryService to get the current entity everything works perfectly, however when I try to invoke the GetSelectionContext method via the list tasks everything blows up with an Object Not Set To An Instance error.

 

This is the javascript I have in the ascx file:

function FXGetSelections(){

var selectionInfo = GetSelectionInfo();

document.getElementById(clientID + '_hfSelections').value = selectionInfo.key;

var svc = Sage.Services.getService('SelectionContextService');

svc.setSelectionContext(selectionInfo.key, selectionInfo, false);

 

And this is the corresponding sever-side method that is called by the items_ItemCommand event:

GroupContextService groupContextService = ApplicationContext.Current.Services.Get<IGroupContextService>() as GroupContextService;

CachedGroup currentGroup = groupContextService.GetGroupContext().CurrentGroupInfo.CurrentGroup;

GroupInfo gInfo = currentGroup.GroupInformation;

ISelectionService srv = SelectionServiceRequest.GetSelectionService();

ISelectionContext selectionContext = srv.GetSelectionContext(hfSelections.Value.ToString());

IList<string> selections = selectionContext.GetSelectedIds();

 

The code always stops when defining the selectionContext object. Any suggestions greatly appreciated as I have been tearing my hair out with this for 3 days now... what am I missing?

 

Copper Contributor
Posts: 25
Registered: ‎09-27-2013

Re: SLX 7.5.4 Group Selections In Common Tasks

I had the same problem, and I think it has to do with clientid being null in your clientside script and conseuqnetly passing a null object to the server-side code,

 

 

try this:

 

function FXGetSelections(){
    var clientId = "<%= ClientID %>" + "_hfSelections"
    var selectionInfo = GetSelectionInfo();
    document.getElementById(clientId).value = selectionInfo.key;
    var svc = Sage.Services.getService('SelectionContextService');
    svc.setSelectionContext(selectionInfo.key, selectionInfo, FXGetSelections);
}

New Member
Posts: 2
Registered: ‎08-11-2014

Re: SLX 7.5.4 Group Selections In Common Tasks

Yep, that worked a treat. Does anyone know where the API developer documentation is located now? The Architect helpfile points to a page on the Sage site that isn't live any longer.

 

Many thanks

Owen