I am trying to get my new form to make an entry into my Lead_History in the background. My "Note" data and "HistoryDate" are patching into my list but my "LeadID" number is not patching. Suggestions on how I can make this work?
FYI: I have 2 SharePoint lists: one for my main data called Lead_Data and one for my tracking of my notes called Lead_History. NewForm submits to Lead_Data.
My forms OnSuccess:
//ADD NEW LEAD CREATED ENTRY INTO LEAD_HISTORY SHAREPOINT LIST UPON CREATION OF NEW LEAD Patch(Lead_History, Defaults(Lead_History), {Title: "", Note: "New Lead Created", HistoryDate: Text( Now(), "[$-en-US]mm/dd/yyyy hh:mm:ss"), LeadID: NewForm.LastSubmit.ID});
My submit button OnSelect:
//SEND MAIL START ClearCollect(ccEmails,{Mail: LookUp(Agents, FullName = ndd_LeadMember1.Selected.FullName, EmailAddressCC)}); Collect(ccEmails,{Mail: LookUp(Agents, FullName = ndd_LeadMember2.Selected.FullName, EmailAddressCC)}); Collect(ccEmails,{Mail: LookUp(Agents, FullName = ndd_LeadMember3.Selected.FullName, EmailAddressCC)}); Collect(ccEmails,{Mail: LookUp(Agents, FullName = ndd_LeadMember4.Selected.FullName, EmailAddressCC)}); Office365.SendEmailV2(LookUp(Agents, FullName = ndd_AssignedTo.Selected.FullName, EmailAddressT), //Subject Line ndd_AssignedTo.SelectedText.Value & ", you have a new lead!", //Message Line "<strong>Name: </strong>" & ntxt_FirstName & " " & ntxt_LastName & "<br><strong>Email: </strong>" & ntxt_Email & "<br><strong>Phone: </strong>" & ntxt_Phone & "<br><strong>Address: </strong>" & ntxt_Unit & ", " & ntxt_Street & ", " & ntxt_City & ", " & ntxt_Province & "<br><strong>Listing Information: </strong>" & ndd_ListingType.Selected.Value & ", " & ndd_PropertyType.Selected.Value & ", " & ndd_Location.Selected.Value & "<br><strong>Source: </strong>" & ndd_Source.Selected.Value & "<br><br><i>Other Lead Members CC'ed: " & ndd_LeadMember1.Selected.FullName & ", " & ndd_LeadMember2.Selected.FullName & ", " & ndd_LeadMember3.Selected.FullName & ", " & ndd_LeadMember4.Selected.FullName & "</i>", {Cc: Concat(ccEmails,Mail,";")} ); //SUBMIT FORM AFTER THE OTHER PROCESSES SO THAT THE FORM DATA DOES NOT BECOME INVALID SubmitForm(NewForm); //NAVIGATE AND RESET THE NEW FORM Navigate( Dashboard, ScreenTransition.Fade ); ResetForm(NewForm);
Solved! Go to Solution.
//ADD NEW LEAD CREATED ENTRY INTO LEAD_HISTORY SHAREPOINT LIST UPON CREATION OF NEW LEAD Set(varNewLeadID, NewForm.LastSubmit.ID); Patch(Lead_History, Defaults(Lead_History), {Title: "", Note: "New Lead Created", HistoryDate: Text( Now(), "[$-en-US]mm/dd/yyyy hh:mm:ss"), LeadID: varNewLeadID}); //NAVIGATE AND RESET THE NEW FORM Navigate( Dashboard, ScreenTransition.Fade ); ResetForm(NewForm);
I was able to work it out! Must have been early morning, after Canadian Thanksgiving brain blunders, as I have no idea why I couldn't put this together this morning!
hey Kimberly lol
try setting var = Lastsubmit.ID before patch function and use {LeadID: var}
Hi @KimberlyM ,
Could you please share a bit more about the LeadID column in your Lead_History SP List? Is it a Number type column or Single text type column?
Based on the Patch function that you mentioned, I could not find any syntax error with it. According to the OnSelect formula of Submit button, I think this issue may be related to the ResetForm(NewForm) formula.
Please consider modify the OnSelect property of the "Submit" button to following:
//SEND MAIL START ClearCollect(ccEmails,{Mail: LookUp(Agents, FullName = ndd_LeadMember1.Selected.FullName, EmailAddressCC)}); Collect(ccEmails,{Mail: LookUp(Agents, FullName = ndd_LeadMember2.Selected.FullName, EmailAddressCC)}); Collect(ccEmails,{Mail: LookUp(Agents, FullName = ndd_LeadMember3.Selected.FullName, EmailAddressCC)}); Collect(ccEmails,{Mail: LookUp(Agents, FullName = ndd_LeadMember4.Selected.FullName, EmailAddressCC)}); Office365.SendEmailV2(LookUp(Agents, FullName = ndd_AssignedTo.Selected.FullName, EmailAddressT), //Subject Line ndd_AssignedTo.SelectedText.Value & ", you have a new lead!", //Message Line "<strong>Name: </strong>" & ntxt_FirstName & " " & ntxt_LastName & "<br><strong>Email: </strong>" & ntxt_Email & "<br><strong>Phone: </strong>" & ntxt_Phone & "<br><strong>Address: </strong>" & ntxt_Unit & ", " & ntxt_Street & ", " & ntxt_City & ", " & ntxt_Province & "<br><strong>Listing Information: </strong>" & ndd_ListingType.Selected.Value & ", " & ndd_PropertyType.Selected.Value & ", " & ndd_Location.Selected.Value & "<br><strong>Source: </strong>" & ndd_Source.Selected.Value & "<br><br><i>Other Lead Members CC'ed: " & ndd_LeadMember1.Selected.FullName & ", " & ndd_LeadMember2.Selected.FullName & ", " & ndd_LeadMember3.Selected.FullName & ", " & ndd_LeadMember4.Selected.FullName & "</i>", {Cc: Concat(ccEmails,Mail,";")} ); //SUBMIT FORM AFTER THE OTHER PROCESSES SO THAT THE FORM DATA DOES NOT BECOME INVALID SubmitForm(NewForm)
Set the OnSuccess property of the Edit form (NewForm) to following:
//ADD NEW LEAD CREATED ENTRY INTO LEAD_HISTORY SHAREPOINT LIST UPON CREATION OF NEW LEAD Patch(
Lead_History,
Defaults(Lead_History),
{
Title: "",
Note: "New Lead Created",
HistoryDate: Text( Now(), "[$-en-US]mm/dd/yyyy hh:mm:ss"),
LeadID: NewForm.LastSubmit.ID
}
); //NAVIGATE AND RESET THE NEW FORM Navigate(Dashboard, ScreenTransition.Fade); /* <-- Put your Navigate formula and ResetForm formula here */
ResetForm(NewForm);
Please consider take a try with above solution, then check if the issue is solved.
Best regards,
@cds& @mdevaney I have tried setting the variable but I don't know how to set a variable to the lastsubmit. It doesn't give me this option.
In my main SPList: Lead_Data ID column I have no idea what it is as it is the ID column that "comes with" the list.
In my second SPList: Lead_History my ID column is set as a number as I assume that is what the ID column is set to.
So now on my OnSuccess of my form I have
Set(varMakeID, Lead_Data.ID) Patch(Lead_History, Defaults(Lead_History), {Title: "", Note: "New Lead Created", HistoryDate: Text( Now(), "[$-en-US]mm/dd/yyyy hh:mm:ss"), LeadID: varMakeID});
As I said above I know my Set won't work as I am not stating what ID number to pull from Lead_Data.
I did test to make sure that a miracle didn't happen. FYI, it didn't.
Any ideas?
//ADD NEW LEAD CREATED ENTRY INTO LEAD_HISTORY SHAREPOINT LIST UPON CREATION OF NEW LEAD Set(varNewLeadID, NewForm.LastSubmit.ID); Patch(Lead_History, Defaults(Lead_History), {Title: "", Note: "New Lead Created", HistoryDate: Text( Now(), "[$-en-US]mm/dd/yyyy hh:mm:ss"), LeadID: varNewLeadID}); //NAVIGATE AND RESET THE NEW FORM Navigate( Dashboard, ScreenTransition.Fade ); ResetForm(NewForm);
I was able to work it out! Must have been early morning, after Canadian Thanksgiving brain blunders, as I have no idea why I couldn't put this together this morning!
This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.
Come together to explore latest innovations in code and application development—and gain insights from experts from around the world.
User | Count |
---|---|
207 | |
72 | |
51 | |
49 | |
20 |
User | Count |
---|---|
264 | |
123 | |
85 | |
79 | |
70 |