cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
psadd2
Helper II
Helper II

Submit Form and Patch at the same time

Hi, I have an issue writing back to my SP List. I have a form the either creates a new record or updates an existing one. No problem so far. I also have some data coming from some other dropdowns that I need to add to the SP record. So I need to submit the for and then Patch the subsidiary data to the record. If it's an existing record then there isn't an issue but if the Submit is creating a NEW record then the Patch will not work. I've tried creating the record by having the Submit form on the button click and then Patching ON Success of the form being submitted because I thought the record would then exist for the Patch to take place....no luck...it's driving me mad.

 

Here is the OnSelect of the Save Details Button:

Set(
varStatus,
"Draft"
);
SubmitForm(frmMainDetails);

 

 Here's the On Success of the form aft the Save Details Button has been pressed

If(
varFormMode = 1,
Patch(
Defaults('Change Control - Main'),
LookUp(
'Change Control - Main',
'Change Number' = varFormData.'Change Number'
),
{
'Sponsor Name': ddSponsorChoice.Selected.'Name (Title)',
'Sponsor eMail': lblSponsorChoiceeMail.Text,
'ASM Name': ddASMChoice.Selected.'Name (Title)',
'ASM eMail': lblASMChoiceeMail.Text,
'PM Name': ddPMChoice.Selected.'Name (Title)',
'PM eMail': lblPMChoiceeMail.Text
}
),
If(
varFormMode = 0,
Patch(
'Change Control - Main',
LookUp(
'Change Control - Main',
'Change Number' = varFormData.'Change Number'
),
{
'Sponsor Name': ddSponsorChoice.Selected.'Name (Title)',
'Sponsor eMail': lblSponsorChoiceeMail.Text,
'ASM Name': ddASMChoice.Selected.'Name (Title)',
'ASM eMail': lblASMChoiceeMail.Text,
'PM Name': ddPMChoice.Selected.'Name (Title)',
'PM eMail': lblPMChoiceeMail.Text
}
)
)
);

Any ideas folks?

 

Thanks

 

10 REPLIES 10

Hi David....yes, I stopped trying to get clever and went for your tried and tested option 😄
Thanks for the kick in the right direction.

Helpful resources

Announcements
Power Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

Community Call Conversations

Introducing the Community Calls Conversations

A great place where you can stay up to date with community calls and interact with the speakers.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Top Kudoed Authors
Users online (5,097)