Skip to main content

I am trying to run an Apex data source action from a row action.  What is the merge syntax to use the current working row to pass as a record to the Apex class?  As of right now, running the row action results in a null-object error.  Below is my Apex class and action setup:



 


This is working for me:


global class ccmVistationSlotFromTemplate {


@InvocableMethod( label='CCM Vistation Slot From Template')
global static void createSlots( List<Parameters> parameterList ) {

Parameters parameter = parameterList[0];

List<CCM_Visitation_Slot_Template__c> templateList = new List<CCM_Visitation_Slot_Template__c>(
[select ... from CCM_Visitation_Slot_Template__c where Id = :parameter.id]);

...//rest of my code, using templateList
}

global class Parameters {
@InvocableVariable(required=true description='Template Record Id' label='Record Id')
public Id id;
}

The label “Record Id” from that last line appears in the skuid page designer, as a separate field below the Apex Action label. (The description “Template Record Id” is ?/help-text for the field.) I pass the record id as {{Id}}.



The parameter List will support multiple parameters by cloning the @InvocableVariable statement inside the Parameters class. Each parameter will have its own field in the page designer. I my have read that a List is required; if not, it seems it would be a preferred method to easily allow future expansion.


Do you need to add the “Record ID” to the List parameterList or is that being done automatically?


That happens automatically. The Parameters class will have whatever properties you include as Invocable Variables. (So maybe you would not need a List to support multiple; I may have stated that inaccurately before.)


Hi Danny and Mike,

Could you both share which versions of Skuid you’re working with? There is a story in our developer’s backlog about passing Ids into a datasource action like this, where the Id is being passed as a string, instead of an ID (i.e. incorrect type). Could you be running into this? If so, I wanted to let you know that we do have this on our radar, but there is not yet an ETA on any changes. 


I am developing on 11.1.14, which is also the Production target. No problems!


We are on 11.1.10.  That may be my issue as I was not able to achieve any results until I set the variable as type ID in the constructor for the related APEX class?


Hi Danny. Just wanted to check in - were you able to resolve the original issue?


Hi Mark,

Yes I as able to get everything working.  Thank you for following up.