web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Issue Creating Dynamic...
Power Apps
Unanswered

Issue Creating Dynamics Opportunity Line From Power App

(0) ShareShare
ReportReport
Posted on by 119

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?

Categories:
I have the same question (0)
  • yashag2255 Profile Picture
    24,769 Super User 2024 Season 1 on at

    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!
  • Jonfarmer4999 Profile Picture
    119 on at

    Hi

     

    I get the exact same error with

     

    Dropdown4.Selected.'Default Unit'

     

    Regards

     

    Jon

  • yashag2255 Profile Picture
    24,769 Super User 2024 Season 1 on at

    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!
  • Jonfarmer4999 Profile Picture
    119 on at

    @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

  • yashag2255 Profile Picture
    24,769 Super User 2024 Season 1 on at

    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!
  • Jonfarmer4999 Profile Picture
    119 on at

    @yashag2255 

     

    Now back to "The unit id is missing".

     

     

  • Verified answer
    yashag2255 Profile Picture
    24,769 Super User 2024 Season 1 on at

    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!
  • Jonfarmer4999 Profile Picture
    119 on at

    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'})

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 796 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 327 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard