Generally apex batch jobs are scheduled to run at particular time intervals. But suppose we have a use case where we need to run the batch job on adhoc basis. We can call the batch apex from a screen flow in that case and the screen flow can be invoked from a button. So, the batch job can be executed on demand. Attached are the screenshots.
In apex, in order to get the current user role name we need to query the UserRole object. We cannot get it directly using UserInfo object since it has only one method related to role i.e getUserRoleId(). Using this Id returned we can get the data from UserRole object. But that is not that complex in flow. In case of flow, we can directly get the current user role name using the syntax: {!$UserRole.Name}. Attached are the screenshots.
We can also pass custom apex-defined variable from flow to LWC. In this case, we have to define the property type as apex://namespace.Classname and expose the same variable as @api. Attached are the screenshots.
Comments
Post a Comment