Announcements
Hi guys,
i wrote an event handler one condition its working fine same i want to achieve in the COC so that
i did an Control name set as a "auto declaration" 'YES '
My event handler code below,
[FormDataSourceEventHandler(formDataSourceStr(HRMCourseAttendee, HRMCourseAttendee), FormDataSourceEventType::Activated)]
public static void HRMCourseAttendee_OnActivated(FormDataSource sender, FormDataSourceEventArgs e)
{
HRMCourseAttendee courseAttendee = sender.formRun().dataSource("HRMCourseAttendee").cursor();
FormButtonGroupControl course = sender.formRun().design().controlName("Course") as FormButtonGroupControl;
course.enabled(courseAttendee.status == HRMCourseAttendeeStatus::Confirmation);
}
Coc code,
[ExtensionOf(formDataSourceStr(HRMCourseAttendee, HRMCourseAttendee))]
final class HRMCourseAttendee_Extension
{
public int active()
{
int ret;
ret = next active();
CourseCertificate.enabled(HRMCourseAttendee.Status == HRMCourseAttendeeStatus::Confirmation);
return ret;
}
}
"CourseCertificate" not declared am getting error please let me know how to achieve same logic in the COC?
Thanks
Thank you very much blue wang.
Hi Riyas,
So, CourseCertificate is form control, right?
In your class, you used formDataSourceStr, I think You will receive an error outside the scope of the variable.
Try this:
[ExtensionOf(formDataSourceStr(HRMCourseAttendee, HRMCourseAttendee))] final class HRMCourseAttendee_Extension { public int active() { HRMCourseAttendee HRMCourseAttendee = this.cursor(); FormButtonGroupControl CourseCertificate = this.formRun().design().controlName("CourseCertificate") as FormButtonGroupControl; int ret; ret = next active(); CourseCertificate.enabled(HRMCourseAttendee.Status == HRMCourseAttendeeStatus::Confirmation); return ret; } }
André Arnaud de Cal...
294,110
Super User 2025 Season 1
Martin Dráb
232,866
Most Valuable Professional
nmaenpaa
101,158
Moderator