How to access an entity attribute while deleting a value in error message text box?.

0
My scenarios was as follows: The user can delete a value (through a delete button) available in Training Event Overview page only if the number of registrations were equal to 0 otherwise the admin/user cannot delete the value. So in Registration_TrainingEvent association (which is between Registration and Training Event) in On Delete of Training object: I selected prevention delete and error message “ Sorry.. We cannot delete this as student $Registration_Trainee/Name  have already enrolled for this course.” (I tried to access the trainee name by using the variable syntax but it did not work ) So in the error message I also wanted to display the Trainee name who is enrolled in the course while displaying the error message so for that what should be done?. Actual Screens: In the page below TrainingEvent_Overview so according to Prevention delete used on Registration_Training Event (In DOM) if we try to delete a element which has a trainee registered for it (here Java which has number of registrations as 1, we get a message which is manually typed {by me} “Sorry cannot delete this”) but in the message I want to also display the name of the Trainee (here Sara to displayed in the message). For that what should be done is t possible in the association itself, if not could you please provide an alternative for it (with the steps)     Trainee_NewEdit (Studental details are entered are in this page) Training Overview Page: Registration_TrainingEvent Association:   DOM:
asked
2 answers
0

Hi Sidhant,

It is not possible to add this data in the error message of a delete prevention action of an association. You would rather solve this by either adding this message in the delete button action on the page, or by adding a before delete event handler to the TrainingEvent object. There, you can use a MF to create an error message for the user who is trying to delete the TrainingEvent. Please bear in mind that with this association you can have multiple registrations and so multiple trainees associated to this trainingevent, so that means that you would have to take this into account in your Microflow logic aswell. 

answered
0

I was able to resolve the above issue by using a microflow. I invoked a microflow (from the Training Event page) through Delete button. In the microflow, the first step was to get the registration entity and TrainingEvent information for which was done using Retrieve object (retrieved the association Registration_TrainingEvent), the second step is to create a empty string which will be used to store the names of the students enrolled in a course (which will be displayed if try to delete a course with Trainee>0). In the third step I used a for loop to iterate over the RegistrationList which was retrieved from the first step, in the for loop I used another Retrieve entity to get the list of Trainee students in course and used a change variable entity which will append the Trainee name in the empty string (here named as Variable) {Expression $Variable + $Trainee/Name}. Outside the for loop I added a Decision box to check if there are no students enrolled (i.e Variable= ‘ ‘/empty) then delete the object else display the message (using show message).

 

Microflow:

 

Expected Result:

 

 

 

 

 

answered