cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
AndersIskov
Level: Powered On

Status of a project: Template, Active,Closed

Hi all,

 

I am working on an application in which a proposal gets created  what a long variety of data. Often, a user will write something, then save it and come back later to the Editform and finalise everything.

 

I have a column named "Proposal Status" for now I have it as a Choices column (but this is NOT a requirement, the crucial thing for me is to either have "Template", "Active" and "Closed".)

 

If a user finalises the proposal he/she can press on "Activate and Download PDF" at this moment I would like for the Proposal Status to change to "Active" automatically. But how do I change the dropdowns selected value (or text-DataCard or any other option) into "Active" by simply clicking that button?

 

When a project is "Active" there are two outcomes: "Won" and "Lost". So I have a second Column called "Outcomes".

 

At this moment I do not wish for the user to edit the form anymore as the PDF is send out to the customer and the result awaits.

Is there a way change the "Outcome" field to either "Won" "Lost" if I click a button in the ViewForm? I was thinking to use Patch() function and have a button called "Won" and a button called "Lost" and then patch that items Outcome-field with either. However, it is quite challenging for me to figure out how to do that.

 

So to sum up:

 

1. How do I go about changing the combobox/dropdowns chosen value by clicking a button (the "Proposal Status")

 

2. How can I change the "Outcome" to either "Won" or "Lost" through the viewform

1 ACCEPTED SOLUTION

Accepted Solutions
Super User
Super User

Re: Status of a project: Template, Active,Closed

@AndersIskov 

 

I think you could put this code in the OnSelect property of the Kazanildi button:

Patch(
    your_datasource_name,
    LookUp(your_datasource_name, ID = id_number_here),
    {Outcome: "Won", 'Proposal Status': "Closed"}
)

 

Then put this code in the OnSelect property of the Kaybedildi button:

Patch(
    your_datasource_name,
    LookUp(your_datasource_name, ID = id_number_here),
    {Outcome: "Lost", 'Proposal Status': "Closed"}
)

 

Of course, you will have to change id_number_here to reference the actual row number.  I like doing this by adding the id field as a card in the view form and making a reference like this:

LookUp(your_datasource_name, ID = Value(DataCardValue_ID.Text))

 

I also tend to make hide the ID field on the form by settings the Card's Visible property to

false

 

---
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

View solution in original post

8 REPLIES 8
Super User
Super User

Re: Status of a project: Template, Active,Closed

Hello again @AndersIskov 🙂

 

To change the status displaying in the dropdown to active I would start by putting this code in the OnSelect property of the button.

Set(defaultProposalStatus, "Active");
Reset(Dropdown1);

 

Then you can put the code as the Default property of your dropdown.

defaultProposalStatus

 

If you want to control what value the dropdown shows when the user gets to the screen you could put code like this in your OnVisible property of that screen.

Set(defaultProposalStatus, "Not Active");

 

Note: my suggestion will only work for a dropdown control, not a combobox.  Sometimes these terms are used interchangeably.

 

Let me know if this 1st solution works and then we can focus on the next one.

 

---
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

AndersIskov
Level: Powered On

Re: Status of a project: Template, Active,Closed

@mdevaney,

 

How you are well! Thank you very much for your reply 🙂

 

I think that should actually do the job. I was thinking it would be more complicated. But when I think about it, the editform will not be entered once the Proposal Status = "Active".

 

Is there a chance you can help me with how to Patch() the Outcome-Field according to "Win" or "Lost" as well as the Proposal Status Field to be changed to "Closed"?

I should mention that I have now changed the Proposal Field to a simple Textfield as I see no reason for it to be a dropdown since users wont interact with that field anyways.

Super User
Super User

Re: Status of a project: Template, Active,Closed

@AndersIskov

Yes, I believe its possible to do the PATCH as well.  Just figured it would be less confusing to solve one problem at a time 🙂

 

Can you please tell me what SharePoint column type is used for each of Outcome-Field and Proposal Status Field?  Is it a Choices column or a Single Line text column?

AndersIskov
Level: Powered On

Re: Status of a project: Template, Active,Closed

@mdevaney,

 

Yes definitely, step by step makes things a 100x easier 🙂

Both of the fields are simple text fields:

 

 

PatchField1.JPG

 

 

I have created two buttons in the ViewForm:

 

PatchField2.JPG

 

Kazanildi = Won

(Ideally, when pressed: Patch Outcome-field= "Won" AND Proposal Status-field = "Closed")

Kaybedildi = Lost

(Ideally, when pressed: Patch Outcome-field= "Lost" AND Proposal Status-field = "Closed")

 

 

 

Super User
Super User

Re: Status of a project: Template, Active,Closed

@AndersIskov 

 

I think you could put this code in the OnSelect property of the Kazanildi button:

Patch(
    your_datasource_name,
    LookUp(your_datasource_name, ID = id_number_here),
    {Outcome: "Won", 'Proposal Status': "Closed"}
)

 

Then put this code in the OnSelect property of the Kaybedildi button:

Patch(
    your_datasource_name,
    LookUp(your_datasource_name, ID = id_number_here),
    {Outcome: "Lost", 'Proposal Status': "Closed"}
)

 

Of course, you will have to change id_number_here to reference the actual row number.  I like doing this by adding the id field as a card in the view form and making a reference like this:

LookUp(your_datasource_name, ID = Value(DataCardValue_ID.Text))

 

I also tend to make hide the ID field on the form by settings the Card's Visible property to

false

 

---
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

View solution in original post

AndersIskov
Level: Powered On

Re: Status of a project: Template, Active,Closed

@mdevaney,

 

Thank you very much again.

 

I will try and implement it first thing in tomorrow, then accept as solution if everything works as intended!

 

 

Super User
Super User

Re: Status of a project: Template, Active,Closed

@AndersIskov 

Of course, please take your time and let me know about any issues 🙂

AndersIskov
Level: Powered On

Re: Status of a project: Template, Active,Closed

@mdevaney 

 

It worked. Thank you once again!

Helpful resources

Announcements
New Ranks and Rank Icons in April

'New Ranks and Rank Icons in April

Read the announcement for more information!

Better Together’ Contest Finalists Announced!

'Better Together’ Contest Finalists Announced!

Congrats to the finalists of our ‘Better Together’-themed T-shirt design contest! Click for the top entries.

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

thirdimage

Community Summit North America

Innovate, Collaborate, Grow - The top training and networking event across the globe for Microsoft Business Applications

Top Solution Authors
Top Kudoed Authors
Users online (9,154)