How to Get an Output Message from Apex Class displayed on Skuid Page as Error Message on a button cl

I am trying to display an output message(which is a variable output from Apex Class) as an error on my SKUID page. The Apex Code(with the required message highlighted) is:

@InvocableMethod(label=‘UpdateTaskStatus’)
public static List UpdateTaskStatus(List lstInput){
List lstOutPuts = new List();
Output objOutput = new Output();
Set UnderWrittingIds = new Set();
List taskList = new List();
List<Stipulation__c> stipList = new List<Stipulation__c>();
Opportunity opp = new Opportunity();

for(input objI:lstInput){
UnderWrittingIds.add(objI.strUnderWrittingId);
}

Underwriting_File__c objUWFile = [select Id,Project_Status__c,Opportunity__c,Account_Name__c,M0_Ready_for_Review_Date_Time__c,
M0_Ready_for_Review_Age__c,M1_Ready_for_Review_Date_Time__c,M1_Ready_for_Review_Age__c,
(select id,Name,Description__c,Status__c,Completed_Date_Time__c,Suppress_Completed_Email_Alert__c from Stipulations__r where Status__c != ‘Completed’ and (Stipulation_Data__r.Name = ‘APR’ or Stipulation_Data__r.Name = ‘ACH’)),
(select Id,OwnerId,Owner.Name from Tasks where whatid in:UnderWrittingIds and status = ‘Open’),
Opportunity__r.isACH__c, Confirm_ACH_Information__c
from Underwriting_File__c where Id in:UnderWrittingIds limit 1];

if(objUWFile != null){
//Added as a part of Orange-2040 - Start
if(!objUWFile.Stipulations__r.isEmpty() && objUWFile.Project_Status__c == ‘M1’) // Added ‘&&’ condition as part of 14705
{
for(Stipulation__c stip:objUWFile.Stipulations__r ) {
stip.Status__c = ‘Completed’;
stip.Suppress_Completed_Email_Alert__c = true; //Added by Adithya as part of 14701.
objOutput.Message = ‘Auto-closed due to M1 approval’;
//lstOutPuts.add(objOutput);
stipList.add(stip);
}
}
/if(objUWFile.Opportunity__r.isACH__c == true && objUWFile.Confirm_ACH_Information__c == ‘ACH data Not Confirmed’)
objUWFile.Opportunity__r.isACH__c = false;
else if(objUWFile.Opportunity__r.isACH__c == false && objUWFile.Confirm_ACH_Information__c == ‘ACH data Confirmed’)
objUWFile.Opportunity__r.isACH__c = true;
/

opp = objUWFile.Opportunity__r;
//Added as a part of Orange-2040 - End
if(!objUWFile.Tasks.isEmpty()){

for(Task objTask :objUWFile.Tasks){
objTask.Review_Date_Time_Complete__c = system.now();
objTask.Status = ‘Complete - Approved’;
taskList.add(objTask);
}
}
try{
if(!stipList.isEmpty())
update stipList;
if(!taskList.isEmpty())
update taskList;
update opp;
lstOutPuts.add(objOutput);
return lstOutPuts;
}Catch(Exception ex){
objOutput.Message = ex.getMessage();
lstOutPuts.add(objOutput);
return lstOutPuts;
}
}
return null;
}

The place where I am trying to place the error message right now is shown here:

Please help with displaying this error as an output message from the class, in SKUID button actions.

Thanks!
Sejal Bhatt

Hi Sejal, I was wondering if you were able to resolve the issue in the meantime. If not, did you already know our online documentation about “Using the Apex Action”? Please find more details here: https://docs.skuid.com/latest/en/data/salesforce/#using-the-apex-action