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

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Customer experience | Sales, Customer Insights,...
Suggested Answer

Quote Detail switching to write-in product leaves productid populated

(0) ShareShare
ReportReport
Posted on by

I have a plugin that is pulling in additional information after a product is selected. When a write-in is selected I also am doing some work. However, what I'm finding is that if you create a quote detail record with an existing product, then update it to a write-in product type that the productid does not clear out like it should. This causes me multiple problems downstream as the quote detail name and the product name are both wrong. They are the concatenation of the original existing product plus the write in product name. I tried to write a plugin that fixes the issue but I get an error because once you set the isproductoverridden to true then any update to the productid field causes an internal error. Looking for a way to get the productid cleared when a quote detail line is switched to write-in.

I have the same question (0)
  • Suggested answer
    Gus Gonzalez Profile Picture
    27,113 on at

    Andrew, have you tried creating a Business Rule that can clear that field for you when you enter a write-in product?

  • Community Member Profile Picture
    on at

    Basically yes. I created a form script that did not work.

    OnChange of the isproductoverridden: If isproductoverridden = true then set the productid field to null

    I also tried in a plugin, but will get an exception that you cannot set the productid when the isproductoverridden is true.

  • Shivkant Soni Profile Picture
    90 on at

    Hi Andrew,

    This might sound like a stupid question to you but would appreciate if you can share details. I tried updating the specific attribute in question here "isproductoverridden" from it is read only once I save the record. Also, I tried using a console it does not throw any exception executes successfully but when I again retrieve the record the value is still what it was before.

    Can you share details on how are you updating the attribute value?

  • Andrew Esther Profile Picture
    35 on at

    isproductoverridden is being changed on the CRM form. It is not disabled for me when doing updates. When you switch to write-in products the existing product (productid) field automatically hides itself and the Write-In product name (productdescription) fields appears. For some reason the productid does not get cleared. However if you switch from write-in back to existing (isproductoverridden) then it does properly clear the write in product name (productdescription).

    This is part of the form script I added which does not work.

    function isproductoverridenChangedHandler(context) {    

       var formContext = context.getFormContext();

       var isproductoverridden = formContext.getAttribute('isproductoverridden').getValue();

       var attr_productid = formContext.getAttribute('productid');  

       if (isproductoverridden) {    

           // clear product

           attr_productid.setValue(null);  

           attr_productid.setSubmitMode('dirty');

       }

    }

  • Shivkant Soni Profile Picture
    90 on at

    Hi Andrew,

    If its clearing the value on changing its value back to Existing product. You might want to try something like this in your code. I know it is redundant to do so, but still it might perform as you expect it to programmatically rather than manually doing it.

    function isproductoverridenChangedHandler(context) {    

      var formContext = context.getFormContext();

      var isproductoverridden = formContext.getAttribute('isproductoverridden').getValue();

      var productOverriddenField = formContext.getAttribute(“isproductoverridden”);

      var attr_productid = formContext.getAttribute('productid');  

      if (isproductoverridden) {    

          productOverriddenField.setValue(false);  

          productOverriddenField.fireOnChange();

          productOverriddenField.setValue(true);

      }

    }

    Triggering fireOnChange should trigger the OOB functionality that you are experiencing when it is being set back to Existing product.

    Hope it helps you to acheive what you are trying to. Please mark it verified if it did :)

    Stay safe and Stay healthy!

  • Community Member Profile Picture
    on at

    There was a response that said I needed to call the fireOnChange() to call the events. That makes sense but did not actually work. The productid field is still populated after save.

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Customer experience | Sales, Customer Insights, CRM

#1
Tom_Gioielli Profile Picture

Tom_Gioielli 81 Super User 2025 Season 2

#2
Gerardo Rentería García Profile Picture

Gerardo Rentería Ga... 49 Most Valuable Professional

#3
#ManoVerse Profile Picture

#ManoVerse 40

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans