I will most likely just re-write my code to work with this way of passing the value to the controller BUT I was curious why the below method doesn't work. Is there a rule about remote action
and passing params? ParentId definitely has a value in the JS. I am finding little information about this way of passing. It seems like the only option is the hidden field.
<a href="javascript:void(0)" class="btn" onClick="refreshBankDataFunction(parentId)">Refresh</a>
function refreshBankDataFunction(parentId){
Visualforce.remoting.Manager.invokeAction(
'BankDataAttachment.webServiceAuth',
parentId,
function(result, event) {
return parentId;
},
{escape:true}
);
}
@RemoteAction
global static string webServiceAuth(String parentId)
{
system.debug('got into webServiceAuth: ' + parentId);
}
//This returns: DEBUG|got into webServiceAuth: {}
UPDATE: When I console.log the parentId and the bankButtonRefresh I get:
bankButtonRefresh: <a href="javascript:void(0)" class="btn-sm btn-primary permissionDeny pull-right" onClick="refreshBankDataFunction(a34c0000000jiezAAA)" >Refresh</a>
parentId: a34c0000000jiezAAA
I should also state that I am building the table in JavaScript:
var bankButtonRefresh = '<a href="javascript:void(0)" class="btn-sm btn-primary permissionDeny pull-right" onClick="refreshBankDataFunction('+parentId+')" >Refresh</a>';
refreshBankDataFunction(parentId)
what is parentId here?var parentId = result[i].Summary.Related_Bank_Data__c;