Create AOT query for below code

It would help if you explained your problem - it’s not clear which part you’re struggling with.
It may be beneficial for you if you rewrite code to a single query, because that’s what you need in AOT. Then you’ll implement the same structure in AOT.

For example:

DirPerson			person;
DirPersonUser 		personUser;
UserGroupInfo 		userGroupInfo;
HcmSharedParameters hmcSharedParams;
UserGroupList 		userGroupList;

select person
	join personUser
		where personUser.PersonParty == person.RecId
		join userGroupList
			where userGroupList.UserId == personUser.User
			join userGroupInfo
				where userGroupInfo.Id == userGroupList.GroupId
				exists join hmcSharedParams
					where hmcSharedParams.UserGroupInfo == userGroupInfo.RecId;

By the way, Scarlett_Jonathon is an AI bot (source). :wink: