You need to sign in to do that
Don't have an account?
Warjie Malibago 15
How to get non-ID fields in List Button?
Hi everyone,
I'm using a list button and calling a method from an external system (all good). However I need to do some validation first before I call the actual method. I'm using GETRECORDSID to get the IDs of the selected items. So I also need to get a field of those selected records to be used for the validation. How can I achieve it? Below's my code:
Appreciate your help. Thanks!
I'm using a list button and calling a method from an external system (all good). However I need to do some validation first before I call the actual method. I'm using GETRECORDSID to get the IDs of the selected items. So I also need to get a field of those selected records to be used for the validation. How can I achieve it? Below's my code:
{!REQUIRESCRIPT("/soap/ajax/25.0/connection.js")} {!REQUIRESCRIPT("/soap/ajax/25.0/apex.js")} {!REQUIRESCRIPT("//ajax.googleapis.com/ajax/libs/jquery/1.8.1/jquery.min.js")} setTimeout(function(){ try{ var selected = {!GETRECORDIDS( $ObjectType.my_custom_object__c)}; for(i=0; i<selected.length; i++){ if({!selected[i].my_custom_field__c} == true){ //this is where I get the error. I cannot access the custom field. alert('Error here = ' + selected[i] '. Click OK to continue'); } else{ result = sforce.apex.execute('external_class','external_method',{purchaseId:selected[i]}); } } } catch(error){ $('#overlayBackground').remove(); $('#overlayOverlay').remove(); alert('An error ocurred'); } },300);If there's no other way around, my last resort would be to use VF page.
Appreciate your help. Thanks!
Something like below :