cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Helper IV
Helper IV

Create new item and patch ID number of new item to two lists - ID number not patching

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);
1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Helper IV
Helper IV

Re: Create new item and patch ID number of new item to two lists - ID number not patching

 

//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!

 

View solution in original post

5 REPLIES 5
Highlighted
Skilled Sharer
Skilled Sharer

Re: Create new item and patch ID number of new item to two lists - ID number not patching

hey Kimberly lol 

 

try setting var = Lastsubmit.ID before patch function and use {LeadID: var}

Highlighted
Super User
Super User

Re: Create new item and patch ID number of new item to two lists - ID number not patching

@KimberlyM
What column type is LeadID in SharePoint? Can you please check to See if LeadID is a number type column? Sometimes data does not save for me because the data going in does not match the column.
Highlighted
Community Support
Community Support

Re: Create new item and patch ID number of new item to two lists - ID number not patching

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,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Highlighted
Helper IV
Helper IV

Re: Create new item and patch ID number of new item to two lists - ID number not patching

@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?

Highlighted
Helper IV
Helper IV

Re: Create new item and patch ID number of new item to two lists - ID number not patching

 

//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!

 

View solution in original post

Helpful resources

Announcements
August 2020 Community Challenge: Can You Solve These?

August 2020 Community Challenge: Can You Solve These?

We're excited to announce our first cross-community 'Can You Solve These?' challenge!

secondImage

Return to Workplace

Reopen responsibly, monitor intelligently, and protect continuously with solutions for a safer work environment.

secondImage

Super Users Coming in August

We are excited for the next Super User season.

secondImage

Community User Group Member Badges

FIll out a quick form to claim your community user group member badge today!

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors
Users online (7,955)