cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Jonfarmer4999
Helper III
Helper III

Issue Creating Dynamics Opportunity Line From Power App

I am trying to create a new opportunity line for an existing opportunity but I am getting the following error. 

 

"The requested operation is invalid. Server Response: The unit id is missing.

 

However I am indicating in the patch to use the default unit. The full patch is below. 

 

Patch('Opportunity Lines',Defaults('Opportunity Lines'),{opportunityid: ID, producttypecode: 'Product Type6'.Product, opportunityproductname: Dropdown4.Selected.Name, quantity: 1, propertyconfigurationstatus: 'Properties Configuration'.Edit, description: Dropdown4.SelectedText.Name, productid: Dropdown4.SelectedText, uomid: Dropdown4.SelectedText.'Default Unit'})

 

Any idea what might be wrong?

1 ACCEPTED SOLUTION

Accepted Solutions

Hey @Jonfarmer4999 

 

Can you share more details about the controls and their properties used to fill the other attributes like opportunityid, productid. I think the issue is with other attribute that might have a lookup and contains "Unit Id" field. Ensure that the lookups are passed using the Choices() function.
 
Hope this Helps!
 
If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

View solution in original post

8 REPLIES 8
yashag2255
Dual Super User II
Dual Super User II

Hey @Jonfarmer4999 

 

Instead of using Dropdown4.SelectedText.'Default Unit', can you try to use: Dropdown4.Selected.'Default Unit'
 
Hope this Helps!

If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

Hi

 

I get the exact same error with

 

Dropdown4.Selected.'Default Unit'

 

Regards

 

Jon

Hey @Jonfarmer4999 

 

Can you share the Item property of the Dropdown control?
 
Also, are you using OOTB opportunity entity? As per the configuration, uomid is a lookup type field, so it should be passed as a valid value:
 
Patch('Opportunity Lines',Defaults('Opportunity Lines'),{opportunityid: ID, producttypecode: 'Product Type6'.Product, opportunityproductname: Dropdown4.Selected.Name, quantity: 1, propertyconfigurationstatus: 'Properties Configuration'.Edit, description: Dropdown4.SelectedText.Name, productid: Dropdown4.SelectedText, uomid: LookUp(Choices('Opportunity Lines'.uomid), ColName =Dropdown4.SelectedText.'Default Unit')})
 
Here, you need to update the ColName with the name of column that contains the values for Default Unit selected through the dropdown.
 
Hope this Helps!
 
If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

@yashag2255 

 

Hi the drop down items is the Products entity. 

 

I am unsure what the Colname should be I have tried uomid but that gives an invalid type error.

 

Regards

 

Jon

Hey @Jonfarmer4999 

 

Can you try to update the expression as:
 
Patch('Opportunity Lines',Defaults('Opportunity Lines'),{opportunityid: ID, producttypecode: 'Product Type6'.Product, opportunityproductname: Dropdown4.Selected.Name, quantity: 1, propertyconfigurationstatus: 'Properties Configuration'.Edit, description: Dropdown4.SelectedText.Name, productid: Dropdown4.SelectedText, uomid: LookUp(Choices('Opportunity Lines'.uomid), Name =Dropdown4.Selected.'Default Unit'.Name)})
 
Hope this Helps!

If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

@yashag2255 

 

Now back to "The unit id is missing".

 

 

Hey @Jonfarmer4999 

 

Can you share more details about the controls and their properties used to fill the other attributes like opportunityid, productid. I think the issue is with other attribute that might have a lookup and contains "Unit Id" field. Ensure that the lookups are passed using the Choices() function.
 
Hope this Helps!
 
If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

View solution in original post

Finally got it to work using this

 

Patch('Opportunity Lines',Defaults('Opportunity Lines'),{opportunityid:ID,producttypecode:'Product Type6'.Product,opportunityproductname:Dropdown4.Selected.Name,quantity:1,propertyconfigurationstatus:'Properties Configuration'.Edit,description:Dropdown4.SelectedText.Name,productid:Dropdown4.SelectedText,uomid:Dropdown4.SelectedText.'Default Unit'})

Helpful resources

Announcements
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

PA Community Call

Power Apps Community Call

Next call is happening on April 21st at 8a PST.

MBAS Carousel

Sign up for our May 4th event!

May the fourth be with you, join us online!

secondImage

Experience what’s next for Power Apps

See the latest Power Apps innovations, updates, and demos from the Microsoft Business Applications Launch Event.

Top Solution Authors
Top Kudoed Authors
Users online (19,105)