Skip to main content

I have a button that has worked for sometime that quit working recently.  The button is set up to run multiple actions. The first action is to run a snippet. The snippet simply creates a Conga Composer action so we can print forms.  The second action closes the popup.  Now when the button is clicked nothing happens.  I opened up the console and I am getting the error VM6683:9 Uncaught TypeError: Cannot read property ‘getSelectedItems’ of undefined.

I did not write the snippet, I just borrowed it from the forums, but it has been working for a long time. Here is the snippet.

var params = argumentsr0],
    $ = skuid.$;
   
   
// Get the Ids of the selected items as an Array


var idsArray = skuid.$.map(argumentsd0].list.getSelectedItems(),function(item){


   return item.row.Id;
});


// Convert this array to a comma-separated String


var idsString = idsArray.join(‘,’);


// Encode the string


var encodedIdsString = encodeURIComponent(idsString);


// STEP 1: CHANGE THE NEXT LINE TO THE TYPE OF RECORDS YOU’RE ACCESSING ON THE VIEW
//var idArray = {!GETRECORDIDS($ObjectType.Account)};


// STEP 2: CHANGE THE NEXT LINE TO THE API NAME OF THE FIELD THAT CONTAINS THE POINTMERGE URL


var urlFieldName=“Conga_Conductor_Fusion_MAR__c”;


// DO NOT MODIFY ANYTHING BELOW THIS POINT ********************

// YOU MAY PASS UP TO 50 IDS

var CongaURL = “https://conductor.congamerge.com”; +
“?MOID=” + encodedIdsString +
“&SessionId=” + skuid.utils.userInfo.sessionId +
“&ServerUrl=” + sforce.connection.partnerServerUrl +
“&UrlFieldName=” + urlFieldName;

window.open( CongaURL, “Conga”, “width=700,height=450,menubar=0” );

Can anyone point me in the right direction so I can get my forms printing again?  Thank you for your help!

9f2d09c7f2b5ce858fa701c5a2223232d9cfadf9.png


Hey Rich,

Try to break your code line “var idsArray = skuid.$.map(argumentst0].list.getSelectedItems(),function(item){ 


   return item.row.Id; 
});”

into like something below:

var $ = skuid.$,
   action = arguments 0].action,    
list = arguments 0].list,     console.log(‘list =’,list);  //see what this prints to console.
model = arguments/0].model,
selectedItems = list.getSelectedItems();

console.log('selectedItems  are :- ', selectedItems );

var idsArray = skuid.$.map(selectedItems ,function(item){ 


   return item.row.Id; 
});


See what it will print on console , then you will be able to see where this is failing.

You may want to refer to this documentation : http://help.skuid.com/m/11720/l/204930-table-component-custom-mass-actions


Hope that helps you debug.




Also , I believe you were trying to get selected rows from a table which is in the popup, and your snippet is not able to find that table component properly due to your action framework issues .

Try to use below sample code to get your table rows selected ,

var table = skuid.$(‘#MyTable’), list, selectedItems;  
//Here #MyTable - is table’s unique ID given in table properties

if (table.length)
{
   list = table.data(‘object’).list;
   selectedItems = list.getSelectedItems();
}

var idsArray = skuid.$.map(selectedItems ,function(item){ 
              return item.row.Id; 
});


Hope this helps!

For more details : https://community.skuid.com/t/getting-the-selected-records-on-a-table-without-using-mass-row-action-and-instead-using-a-button/1497