cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
CraigBarbieri
Frequent Visitor

Patching help

I could use an assist on this. I can’t seem to write a patch that creates a new line in 'Subcontractor Buyout List' from information on 2 screens in my app. 

This is what I’ve got for my submit button and it's supposed to update the existing subcontractor, or create a new one. But, it doesn’t do anything:

 

 

 

If(Screen2_SUBCONTRACTOR.Mode = New,

Patch('Subcontractor Buyout List', Defaults('Subcontractor Buyout List'),

                                Screen2_SUBCONTRACTOR.Updates,

                                Screen3_BUDGET.Updates

                ),            

                Patch('Subcontractor Buyout List', LookUp('Subcontractor Buyout List', 'Company Name'= 'Company Name_DataCard1_1'.Default),

                                Screen2_SUBCONTRACTOR.Updates,

                                Screen3_BUDGET.Updates

                                )
                );

Notify("Selected Successfully",Success); RequestHide()

 

 

 

I’m getting a couple errors:

  1. ‘If’ has some invalid arguments
  2. ‘Patch’ has some invalid arguments

I’m not sure if I’m identifying the item correctly with the lookup.  I'm a n00b at this. I attached the app itself if that helps. 

Thanks for any help

1 ACCEPTED SOLUTION

Accepted Solutions
WarrenBelz
Super User
Super User

Hi @CraigBarbieri ,

I think your issue is in the second Patch with the Default reference - with the below

If(
   Screen2_SUBCONTRACTOR.Mode = New,
   Patch(
      'Subcontractor Buyout List', 
      Defaults('Subcontractor Buyout List'),
      Screen2_SUBCONTRACTOR.Updates,
      Screen3_BUDGET.Updates
   ),            
   Patch(
      'Subcontractor Buyout List', 
      {'Company Name':'Company Name_DataCard1_1'.Selected.xxxx},
      Screen2_SUBCONTRACTOR.Updates,
      Screen3_BUDGET.Updates
   )
);
Notify("Selected Successfully",Success); 
RequestHide()

 xxxx will be whatever the valid output of your drop-down / combo box is (Result / Value / Field name)

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

View solution in original post

3 REPLIES 3
WarrenBelz
Super User
Super User

Hi @CraigBarbieri ,

I think your issue is in the second Patch with the Default reference - with the below

If(
   Screen2_SUBCONTRACTOR.Mode = New,
   Patch(
      'Subcontractor Buyout List', 
      Defaults('Subcontractor Buyout List'),
      Screen2_SUBCONTRACTOR.Updates,
      Screen3_BUDGET.Updates
   ),            
   Patch(
      'Subcontractor Buyout List', 
      {'Company Name':'Company Name_DataCard1_1'.Selected.xxxx},
      Screen2_SUBCONTRACTOR.Updates,
      Screen3_BUDGET.Updates
   )
);
Notify("Selected Successfully",Success); 
RequestHide()

 xxxx will be whatever the valid output of your drop-down / combo box is (Result / Value / Field name)

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

WarrenBelz
Super User
Super User

Hi @CraigBarbieri ,

Just checking if you got the result you were looking for on this thread. Happy to help further if not.

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

CraigBarbieri
Frequent Visitor

Thanks for the help. I've tried a bunch of options there and unfortunately I'm still getting "Invalid argument".

This is the latest code:

If(Screen2_SUBCONTRACTOR.Mode = New,
Patch('Subcontractor Buyout List', Defaults('Subcontractor Buyout List'),
		Screen2_SUBCONTRACTOR.Updates,
		Screen3_BUDGET.Updates
	),
	Patch('Subcontractor Buyout List', LookUp('Subcontractor Buyout List', 'Company Name'= 'Company Name_DataCard1_1'.Selected.Text),
		Screen2_SUBCONTRACTOR.Updates,
		Screen3_BUDGET.Updates
		)
	);

 

I've tried value, text, but am not clear on how to identify the ID in the lookup. 

 

Helpful resources

Announcements
2022 Release Wave 1 760x460.png

2022 Release Wave 1 Plan

Power Platform release plan for the 2022 release wave 1 describes all new features releasing from April 2022 through September 2022.

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Top Solution Authors
Top Kudoed Authors
Users online (1,822)