38
Views
9
Comments
What control to use to give option for approve or reject
Question

I am trying to give option to an approver the option to either approve or reject a request. If the approver approve the request then it should change the status of the activity from New activity to approve or reject status. I have uploaded the screen shot and the .oml of my app

TimeSheetApproveorRejectstate.oml

Rank: #9125

The screen shot of the screen

ApprovOrReject.png

mvp_badge
MVP
Rank: #68

Hello Badar.

Your database is still very raw and hard to read.


Basically you need to create an action on the screen that receives as parameter the ActivityCreationId and if it is approved or rejected. When the button in a row is clicked, it calls the action and changes information into the database. Your database is not ready for status yet.


mvp_badge
MVP
Rank: #68

Here.

I changed your Status entity to be Static so you can assign it. That forced me to delete some unnecessary screens/actions.

Key changes:

On ActivityCreationDetail action SaveDetail I set ActivityStatusId to new when it is a Create. Leave it as is when is an Update.

On the screen you wanted to be changed, you can see the button to Approve/Reject that is replaced by the text after the decision is saved.


TimeSheetApproveorRejectstate.oml

Rank: #9125

Hi Nuno,

After downloading the .oml I try to publish one click but received the following error

Upgrade Error
Could not create foreign key constraint. This may have happened because there are 'ActivityStatus' values of entity 'ActivityCreation' with no corresponding value in entity 'ActivityStatus', or attribute 'ActivityStatus' of entity 'ActivityCreation' is creating a circular dependency between entities. Check the Error Log for more information.

Secondly I could not get why do I have to change the activity status to a static entity as I have used the entity identifier number in the other options So I would not change its status.

mvp_badge
MVP
Rank: #68

The error is because I change the Entity.


What you asked for was a simple way to Approve/Reject. The way I read your project, you want to save status in ActivityCreation.ActivityStatus. But if Activity Status is a text, you can't do it with a single click. You need to open some text input and save it.

You can read my logic and see if something applies to your idea. Or explain what you expect to save in Status table.

mvp_badge
MVP
Rank: #68

Hi Badar.

I looked again to your project. You have different columns to Approve/Reject and Status so it is not the same.

But you don't have any attribute to save the Approve/Reject so I created State.

I placed a WebBlock with the buttons on-screen and the DB logic to change state is there. You may want to add logic to save TF and such.

About the permissions, my suggestion is that you do another screen where you filter by TF and there you use the buttons.


TimeSheetApproveorRejectstate.oml

mvp_badge
MVP
Rank: #68

Hello.

First, you are using the same variable for all. 

You should be using 

GetActivityCreationsByTFTechnicianRACIF.List.Current.ActivityCreation.ApproveOrReject

And please make that attribute a boolean.


Second, you should be giving options to Approve or Reject. With a checkbox you can only approve or not approve. It is completely different.

That's why I created a static with 3 options: Approve. Reject, Neither. And with two buttons I can say Approve, or Reject orv wait.


After that, don't forget to create an Action to Save.