Dear experts,
i am trying to disable a field on Hcmworker form, the field is in a customized table called "XWorkerX" and the field is WorkerCNSS
what i am trying to achieve is the below:
whenever the logged in user (curiserid) equals to a worker on hcmworker i want that field to be enabled, otherwise the field will be disabled,
the purpose is that the employees has access to the worker form, i have no problem with that, but since they have access they can change WorkerCNSS field,
i tried the below code on Activated Datasource method but it didnt work, the field is always disabled
FormDataSource XworkerXDS = sender.formrun().dataSource("XworkerX");
select DirPersonUser where DirPersonUser.User == curUserId();
while select hcmworker join AllUsers where AllUsers.PersonParty == hcmworker.Person
{
if(AllUsers.user != curUserId())
XworkerXDS.object(fieldNum(XworkerX,WorkerCnss)).enabled(false);
else
XworkerXDS.object(fieldNum(XworkerX,WorkerCnss)).enabled(True);
}