32
Views
4
Comments
Solved
For each loop not able to access created Id
Question
Application Type
Reactive

Hi Community,

I am going to attach 2 screen shots of my logic. 

  • I am trying to create a new user, before that, i do have some logic in place
    • Namely to check whether user already exist, or had been set to inactive etc

My original logic works, mainly for the if/else node (Is new user?) => ForEach(RoleList), i am able to get the ID from the User_CreateOrUpdate server action.

However, when i add more validations and logic in my revised codes, the CreateUser_Role is not able to access the Id in the User_CreateOrUpdate action.

Does anybody knows why?

Thank you!


2025-01-23 09-22-22
ABHIJITH G
Champion
Solution

Hi Jun Mun Chan,


The Id from User_CreateOrUpdate was not getting into the CreateUserRole because there are different paths to hit the Create_UserRole action in the second screenshot you shared. If it comes to the CreateUser_Role without hitting the User_CreateOrUpdate, the Id from User_CreateOrUpdate will not get into the CreateUser_Role.
But in the first screenshot, there is no connection from the start node to CreateUser_Role without hitting User_CreateOrUpdate so the CreateUser_Role will get the Output from the User_CreateOrUpdate. I added a screenshot for showing you the path which is not having the hit to the User_CreateOrUpdate.
I will suggest you create a local variable of type UserId and assign the proper value in each path from the Start  node to Create_UserRole then use the variable in the Create_UserRole instead of using the Id from User_CreateOrUpdate


Thanks

1738292125739.png
2025-01-31 03-15-38
Irfan Ahamed Abdul Shukoor

Hi @Jun Mun Chan ,

Hope you doing well.
Please refer to the attached sample image based on your attached images.

1. You are able to access the output from the server actions directly to the createorupdate action.

2. Same if you have mutliple actions after usercreate you are able to use the Id created throughtout the createorupdate action.

3. In the 3rd image, i have included several if conditions implemented in the logic. In this case, the createorupdate action is based on either one of the if else condition, so as per the conditions user might be a already exisited or it might now . i can either add the entity and filter out the required data and send it to the createorupdate action to proceed if the user exist or perform other actions. 

Note: In conditional cases, you are not able to access the server action out directly to the createorupdateactions.

4. In the 4th image, i have created a local variableand assigned the output of the required server action to it. so i can use the local variable in the createorupdate action. 

Let me know if it helps.

Thanks

2023-11-22 10-51-50
Jozy Sohail

Hi Jun Mun Chun,

It is because of your "User active and IsAcvite" if and "User is Inactive" if flow, because if your "User active and IsAcvite"  is false and "User is Inactive" is true, then your User_CreateOrUpdate is never called and it will not be available in the create action.

try to add it before the "does not exist at all", it should work.

Hope it helps.

2022-05-01 03-47-53
Jun Mun Chan

Thank you everyone for your guidance! Now i know where i went wrong, and had implemented the correction. Had marked the first reply as solution

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.