web
You’re offline. This is a read only version of the page.
close
Skip to main content
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();
}

I have the same question (0)
  • Verified answer
    Martin Dráb Profile Picture
    236,353 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.

  • 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

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Abhilash Warrier – Community Spotlight

We are honored to recognize Abhilash Warrier as our Community Spotlight honoree for…

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
CA Neeraj Kumar Profile Picture

CA Neeraj Kumar 2,028

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 878 Super User 2025 Season 2

#3
Sohaib Cheema Profile Picture

Sohaib Cheema 579 User Group Leader

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans