My app is designed to track lead status and progress. On my "Edit" Screen I have 2 Forms.
One submits data to my Lead_Data SharePoint list and is data that should not be easily changed so I have it set to view only when the page is loaded.
The other submits data to my Lead_History SharePoint list and is the main form to edit when you come to this page.
The initial status after the lead is newly created is set to Not Started (this is in my Lead_Data SPL). When the user comes to add a item to the activity tracker area (my Lead_History SPL) I would like it to update the status automatically without having to edit the Lead_Data form to "In Progress".
The below code is what I have come up with so far (see red text), but doesn't work. The first Patch statement works perfectly and as I expect. Suggestions on either how my thinking is wrong or how I can correct my thinking? Thanks!
Patch(Lead_History, Defaults(Lead_History), {Title: "", Note: txt_HistoryDetail.Text, HistoryDate: Text( Now(), "[$-en-US]mm/dd/yyyy hh:mm:ss"), LeadID: Gallery_Dashboard.Selected.ID}); If(Gallery_Dashboard.Selected.Status.Value = "Not Started", Patch(Lead_Data, Gallery_Dashboard.Selected, {Status: '@odata.type': "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference", Id: 0, Value: "In Progress"}));
The Status field that defines what should be loading is a choice field. When I use the code you suggest the button does nothing - it loads nothing, changes nothing. This is either the problem I keep having with this button or that it loads nothing but a blank screen.
I have even tried to use collections but I can't get these to load either.
// Collect Not Started & In Progress :::::: ACTIVE DEALS :::::: ClearCollect(colDash_ActiveDeals, Filter(Lead_Data,Status.Value="Not Started")); Collect(colDash_ActiveDeals, Filter(Lead_Data,Status.Value="In Progress")); Set(varActiveDeals, colDash_ActiveDeals); // Collect Dead Deals :::::: DEAD DEALS :::::: ClearCollect(colDash_DeadDeals, Filter(Lead_Data,Status.Value="Dead Deal")); // Collect Completed Deals :::::: COMPLETED DEALS :::::: ClearCollect(colDash_CompletedDeals, Filter(Lead_Data,Status.Value="Completed Deal"));
Hi @KimberlyM ,
Could you tell me the data type of Status field?
If it is a choice data type, try this formula:
If(Gallery_Dashboard.Selected.Status.Value = "Not Started",
Patch(Lead_Data, Gallery_Dashboard.Selected, {Status:{Value:"In Progress"}}));
If it is a look up field, try this formula:
If(Gallery_Dashboard.Selected.Status.Value = "Not Started",
Patch(Lead_Data, Gallery_Dashboard.Selected, {Status: '@odata.type': "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference", Id: Gallery_Dashboard.Selected.ID, Value: "In Progress"}));
Here's a similar issue about how to update lookup field for your reference:
Best regards,