getSelectedIds

Posted by Rollbase User on 14-Nov-2012 21:03

I maybe missing something obvious, however, regardless if I have selected records in a list view or not rbv_api. getSelectedIds seems to return null.

All Replies

Posted by Admin on 14-Nov-2012 21:52

Hi



After selection of records what action did you do?

If im not mistaken an action (most likely mass update or group workflow) would first need to be invoked before you can retrieve selectedIds server side.



Hope this helps

Piscoso, Martin

Posted by Admin on 14-Nov-2012 21:55

The intention was to use along with send email action, the selected ids being added to the email template

Posted by Admin on 14-Nov-2012 22:06

Hi



where are the email addresses stored? on the records themselves or are they housed in another object? it might be that you dont actually need the api and just need to use tokens on the to: and cc: fields instead.



have you created the workflow action that would trigger the email sending?

I would prefer you use a group workflow action and append the email trigger to the action via the select triggers to run option on workflow actions. Makes the config cleaner imo since you dont need to specify trigger timing to the triggers that need to run on the action.



Hooe this helps.

Piscoso, Martin

Posted by Admin on 14-Nov-2012 22:26

Sorry I should have been more clear. The idea is for the user to select several records an then use the send email workflow action to send a single email to several people (user will input email addresses). I was hopping to use the getSelectedIds in order to list the selected records in the email body.

Posted by Admin on 14-Nov-2012 22:30

I do not confirm the problem, API works as expected. I've added the following example to Chapter 6:





var arr = rbv_api.getSelectedIds("order");

var buff = '';

if (arr!=null) {

for (var k=0; k

buff += arr[k]+', ';

}

return buff;

Posted by Admin on 14-Nov-2012 22:51

Hi,



I see where your coming from, so this is a display requirement.

Using pavel's script as reference :



Create a trigger (update field value) and save the values of the records that you'd need in the email to a text area.





var arr = rbv_api.getSelectedIds("objName");

var buff = '';

if (arr!=null) {

for (var k=0; k

buff += String( rbv_api.getFieldValue('objName', parseInt(arr[k]), 'fieldtobesaved') );

}

return buff;





After this trigger runs, you can use the saved value of the text area as a token within the email template.



Hope this helps,

Piscoso, Martin

Rollbase

Posted by Admin on 14-Nov-2012 23:32

Martin/Pavel, thanks for your assistance.

Posted by Admin on 14-Nov-2012 23:37

Hi Andrew,



Did you get it working already?



Posted by Admin on 14-Nov-2012 23:45

Martin,

I did not, after looking more closely I realized that the Send email workflow action does not function as I expected when set to allow group. I am needing to send an single email listing all the selected records rather than an email for each record. I believe I will need to take another route.



I can make it work as you suggested with the update and send email triggers, but I liked the option where the user could add additional email addresses, add attachments etc.

Posted by Admin on 14-Nov-2012 23:49

Hi,



I would suggest that you make another object to house group/mass emails and simply attach the records via lookup, the ones that you'd like to be associated the mass email.



1 Mass email would be related to Many records, wherein the email trigger would be inside of this new Mass Email object, and the email template (body) would contain a loop of related records (from the lookup) - to display the items selected.

- This could be an easier path for you to take :)



Piscoso, Martin

Rollbase

Posted by Admin on 15-Nov-2012 00:23

Martin,

You read my mind, this is what we are doing.

This thread is closed