Showing results for 
Search instead for 
Do you mean 
Community Home Request Access Read Blogs Share Your Ideas Search Community View My Settings
Copper Super Contributor
Posts: 20
Registered: ‎10-10-2012

multiple selection using lookup

Trying to do multiple selection of records (contact) using a lookup, is it possible to accomplish/hack in 754 ?

Smiley Happy

Nickel Contributor
Posts: 46
Registered: ‎08-17-2009

Re: multiple selection using lookup

I'm currently working on it for selecting multiple Contacts to an Opportunity.  I've got the additional requirment of limiting the Contacts to those of the Account linked to the Opportunity.  With thanks to Todd Hardin and Nicolas Galler, I've got a semi-working Editable Grid with a Relate Tool.  It will let you multi-select, and correctly adds the Contacts to the Opportunity, but I have not been able to refresh the lookup to restrict the Contacts to the current Account.  The issue that I run into is that I can filter for the 1st Account, but if the user changes the Account on an Opp, or simply navigates to a 2nd Opp with a different Account, the lookup does not refresh.  I belieive that the proper code is in place, but I need to figure out a way to kill the data in the lookup and force it to refresh.  I can tell it's not refreshing because SLXProfiler does not log any SQL when clicking the + sign on the grid a second time.


Anyways, to get were I am, add an Editable Grid with a relate tool.  on the form load, do this:


Sage.Platform.WebPortal.Services.ClientContextService ccs = PageWorkItem.Services.Get<Sage.Platform.WebPortal.Services.ClientContextService>();

Sage.Entity.Interfaces.IOpportunity opp = (Sage.Entity.Interfaces.IOpportunity)BindingSource.Current;


accountId = "";


(opp.Account != null){

accountId = (









ccs.CurrentContext.Add (

"OpportunityAccountId", accountId);


On the Relate Tool (not grid) ConditionalWhere, do this:

function() {

var ccs = Sage.Services.getService("ClientContextService");

var accid = ccs.getValue("OpportunityAccountId");

if (accid == null) return "";

if (accid == "") return "";

return "Account.Id eq '" + accid + "'";



Right now, I'm playing with the java file to see if I can figure out how to reinitialize the lookup, but I've been at it for a week or so...

Nickel Contributor
Posts: 46
Registered: ‎08-17-2009

Re: multiple selection using lookup

I accomplished it by overriding showLookup:


                                lup.showLookup = function() {

                                                var sError = 'The lookup cannot be displayed because one or more conditions have not been met.';

                                                var showError = function (msg) {

                                                                var msgService = Sage.Services.getService('WebClientMessageService');

                                                                if (msgService != null && typeof msgService !== 'undefined') {



                                                                else {




                                                var oCanShowLookup = this.canShowLookup();

                                                if (typeof oCanShowLookup !== 'object') {

                                                                showError('The call to the function canShowLookup() returned an invalid result.');



                                                if (typeof oCanShowLookup.result === 'boolean' && oCanShowLookup.result) {

                                                                var self = this;


                                                                var dHeight = (self.dialogHeight > 0) ? self.dialogHeight : 390;

                                                                var dWidth = (self.dialogWidth > 0) ? self.dialogWidth : 600;

                                                                var digitId = dijit.byId([, '-Dialog'].join(''));

                                                                if (digitId)



                                                                               dijit.byId([ + '-Grid'].join('')).destroy();



                var lookupDialog = new dijit.Dialog({

                                                                                title: self.dialogTitle,

                                                                                id: [, '-Dialog'].join(''),

                                                                                style: ['height:', dHeight, 'px;width:', dWidth, 'px;'].join(''),

                                                                                refreshOnShow: false,

                                                                                _onKey: lup._onKey


                                                                // Calculate the grid height by subtracting the height of the other dialog elements from the dialog height: dheight-125.

                                                                lookupDialog.attr("content", self.dialogContent.apply({ cancelText: self.cancelText, dialogButtonText: self.dialogButtonText, id:, gridHeight: dHeight - 125 }));


                                                                //ToDo: Condition Manager needs to be added to the Sage.UI namespace.

                                                                dojo.connect(ConditionManager.prototype, 'addLookupCondition', this.dialogResize);



                                                                dojo.destroy([, '-Dialog_underlay'].join(''));

                                                                //Position the dialog just below the main header.

                                                      [, '-Dialog'].join(''), 'top', '60px');

                                                      [, '-Dialog'].join(''), 'left', '25%');




                                                else {

                                                                if (typeof oCanShowLookup.reason === 'string' && oCanShowLookup.reason.length != 0) {

                                                                                sError = oCanShowLookup.reason;





New Member
Posts: 1
Registered: ‎11-04-2013

Re: multiple selection using lookup

I was also thinking so but i can't do it.