@Return is one of the very useful function that is introduced in 11x. I have been using it more frequently now and some of the cases are listed below:
Syntax:
@RETURN ("ErrorMessage", ERROR)
1. In custom Workforce planning when business need to add TBH (To be Hired) with basic information such as Start Date, Grade, salary. While adding, system need to validate that date and salary is provided and this is where @return comes handy. If validation fails, one can use @Return function with appropriate message.
2. In one of the requirements, there was a need to archive existing projects to dummy members (user selected) and if required restore back to existing available project member. system must not allow user to move project to a member that already has data. So, it was necessary to give appropriate message to the user. I used the following command in case the validation fails:
@RETURN(@CONCATENATE
(
@CONCATENATE
(
@CONCATENATE("ERROR: Failed to archive selected project [", @NAME({Project})),
@CONCATENATE("] under Entity [", @NAME(@CURRMBR("Entity")))
)
,
@CONCATENATE
(
@CONCATENATE("]. The target project [", @NAME({Archive_Project_to})),
"] is already in use. Try using another new / archived project."
)
)
, ERROR);
The message looks as follows:
"ERROR: Failed to archive selected project [Project1] under Entity [Entity1]. The target project [Temp_Proj1] is already in use. Try using another new / archived project."
Syntax:
@RETURN ("ErrorMessage", ERROR)
1. In custom Workforce planning when business need to add TBH (To be Hired) with basic information such as Start Date, Grade, salary. While adding, system need to validate that date and salary is provided and this is where @return comes handy. If validation fails, one can use @Return function with appropriate message.
2. In one of the requirements, there was a need to archive existing projects to dummy members (user selected) and if required restore back to existing available project member. system must not allow user to move project to a member that already has data. So, it was necessary to give appropriate message to the user. I used the following command in case the validation fails:
@RETURN(@CONCATENATE
(
@CONCATENATE
(
@CONCATENATE("ERROR: Failed to archive selected project [", @NAME({Project})),
@CONCATENATE("] under Entity [", @NAME(@CURRMBR("Entity")))
)
,
@CONCATENATE
(
@CONCATENATE("]. The target project [", @NAME({Archive_Project_to})),
"] is already in use. Try using another new / archived project."
)
)
, ERROR);
The message looks as follows:
"ERROR: Failed to archive selected project [Project1] under Entity [Entity1]. The target project [Temp_Proj1] is already in use. Try using another new / archived project."
No comments:
Post a Comment