Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Answered

Error executing code: FormFunctionButtonControl (data source) has no valid runable code in method 'Clicked'. Stack trace (C)\Forms\SLPRLAttendanceImportScreen\Designs\DesignList\btnImportExcelData\Methods\Clicked

(0) ShareShare
ReportReport
Posted on by 131

Import time and attendance

I am facing this issue when clicking on import button. What is the best solution

clicked method is given below

 

void clicked()
{
#define.count1(10)
#AviFiles
System.Exception ex;
SLJmgAttendanceDataImport attendanceDataImport = new SLJmgAttendanceDataImport();


//ImportUtility.Import importObj;
ImportUtilityZKK.Import importObj;
int rowsAffected = 0;
Filename fileName;
SLTimeImportTable slTimeImportTable;
SLJmgAttendanceImport slAttendanceImport;
SLAIFTimesheetImport slAifAttendanceImport;
//super();
PRLPayrollParameters payrollParameters = PRLPayrollParameters::find();
NoYes useOldEmployeeId = NoYes::No;

SysOperationProgress progress = new SysOperationProgress(1, true);

progress.setCaption("Attendance import is in progress");
progress.setAnimation(#AviUpdate);
progress.setTotal(#count1);


try
{
if ((PayrollPayCycleLookup.valueStr() != "" && PayrollPayPeriodLookup.value() != 0 ) || MultiplePayCycleCheckBox.value())//&& JmgProfileId.valueStr() != "")
{
if (ImportFromUtility.value() == true)
{
useOldEmployeeId = payrollParameters.SLUseOldEmployeeIdOnImport;

slAifAttendanceImport = new SLAIFTimesheetImport();
slAifAttendanceImport.setMultiParms(PayrollPayPeriodLookup.value(),
fileName,
LocationBased.selection(),
MultiplePayCycleCheckBox.value(),
useOldEmployeeId);

slAifAttendanceImport.importAndParseAttendanceFromUtility();
rowsAffected = slAifAttendanceImport.transferImportTableIntoExcelData();

info(strFmt("%1 records imported Successfully!", rowsAffected));

/*
importObj = new ImportUtilityZKK.Import();
fileName = importObj.ReadImportConfig(curext(), sessionId(), curUserId());
if (fileName != "")
{
delete_from slTimeImportTable
where slTimeImportTable.UserId == curUserId()
|| slTimeImportTable.SessionId == sessionId();


//where slTimeImportTable.SessionId == sessionId();

progress.setCount(10);
importObj.ParseAttendanceFile();
//rowsAffected =importObj.InsertIntoAX(PayrollPayPeriodLookup.value());
rowsAffected = SLAIFTimesheetImport::ImportAttendance(PayrollPayPeriodLookup.value(), fileName, LocationBased.selection(), curUserId(), MultiplePayCycleCheckBox.value(), payrollParameters.SLUseOldEmployeeIdOnImport);

delete_from slTimeImportTable
where slTimeImportTable.UserId == curUserId()
|| slTimeImportTable.SessionId == sessionId();

info(strFmt("%1 records imported Successfully!", rowsAffected));
}
else
{
info("Failed to import records!");
}
*/
}
else
{
attendanceDataImport.parmFileName(SLJmgAttendanceImportFile.Filename);
attendanceDataImport.parmAttendanceFileInfo(SLJmgAttendanceImportFile);
attendanceDataImport.parmPayPeriod(SLJmgAttendanceImportFile.PayPeriod);
//
attendanceDataImport.parmLocationBased(LocationBased.selection());
////
attendanceDataImport.parmMultiplePayCycle(MultiplePayCycleCheckBox.value());
attendanceDataImport.run();
//super();
}

}

}
catch(Exception::Info)
{
ex = CLRInterop::getLastException();
info(ex.ToString());
}

//SLJmgAttendanceExcelData_ds.executeQuery();
//element.updateDesign();
}

  • Laraib Profile Picture
    131 on at
    RE: Error executing code: FormFunctionButtonControl (data source) has no valid runable code in method 'Clicked'. Stack trace (C)\Forms\SLPRLAttendanceImportScreen\Designs\DesignList\btnImportExcelData\Methods\Clicked

    First of all I would like to thank you for correcting me. After your guidance I have edited my post now you can understand my code easily. By the way after applying your suggestion my issue has been resolve.

    Thank you

  • Verified answer
    Martin Dráb Profile Picture
    232,942 Most Valuable Professional on at
    RE: Error executing code: FormFunctionButtonControl (data source) has no valid runable code in method 'Clicked'. Stack trace (C)\Forms\SLPRLAttendanceImportScreen\Designs\DesignList\btnImportExcelData\Methods\Clicked

    Please recompile the form. If it doesn't find any compilation errors, run the form again. If it finds compilation errors, fix them and compile the code once more.

    By the way, your code lost line indentation and therefore is difficult to read because you pasted it in a wrong way. Next time, please switch the the rich formatting view and use Insert > Insert Code.

    And what are you trying to achieve by catch(Exception::Info)? It doesn't make sense to me.

    I changed the category of this thread from Human Resources and Payroll to Development / Customization / SDK.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

🌸 Community Spring Festival 2025 Challenge 🌸

WIN Power Platform Community Conference 2025 tickets!

Jonas ”Jones” Melgaard – Community Spotlight

We are honored to recognize Jonas "Jones" Melgaard as our April 2025…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 294,161 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 232,942 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,158 Moderator

Leaderboard

Product updates

Dynamics 365 release plans