Skip to main content
Nintex Community Menu Bar
Question

Run Data Source Action Merge Syntax

  • July 11, 2024
  • 8 replies
  • 31 views

Forum|alt.badge.img+4

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 topic has been closed for replies.

8 replies

Forum|alt.badge.img+9

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.


Forum|alt.badge.img+4

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


Forum|alt.badge.img+9

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.)


Forum|alt.badge.img+10
  • Nintex Employee
  • July 11, 2024

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. 


Forum|alt.badge.img+9

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


Forum|alt.badge.img+4

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?


Forum|alt.badge.img+10
  • Nintex Employee
  • July 11, 2024

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


Forum|alt.badge.img+4

Hi Mark,

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