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 :
Microsoft Dynamics CRM (Archived)

Modifying the Revise Quote functionality and/or button

(0) ShareShare
ReportReport
Posted on by 229

Hello community,

I'm having issues with getting the Revise Quote functionality to work properly.

I've added a custom entity "CustomPosition" to the system and added it to the quote form as a subgrid. When a user revises the quote, it'll create a new quote, but it'll not include those records. How can I extend the Revise Quote functionality and/or button to include the related CustomPositions?

I ventured into the process of how to customize the buttons in the ribbons and I'm quite honestly baffled at how complicated this seems to be. I was able to identify the following "Custom Javascript Action", but I have trouble locating this code:

$webresource:Sales/_static/sfa/quotes/QuoteRibbonActions.js:Sales.QuoteRibbonActions.Instance.reviseActiveOrClosedQuote

How do I get a copy of QuoteRibbonActions.js to base my custom version on? The Webresources Manager (XrmToolBox) doesn't show a _sales element within the "Sales" node when I browse my environment

Alternatively: Any suggestions how else I could fulfill my requirement, e.g. a plugin?

*This post is locked for comments

I have the same question (0)
  • Verified answer
    a33ik Profile Picture
    84,331 Most Valuable Professional on at

    Hello,

    As for me plugin is better solution - community.dynamics.com/.../catch-the-revise-quote-message-inside-a-plugin

  • DKasp Profile Picture
    229 on at

    I prefer plugins, too - this looks like exactly what I needed, thank you very much - I'll give it a try!

  • DKasp Profile Picture
    229 on at

    So I've tried using that solution, but there is not QuoteId InputParameter at all. How did you get this to work?

    context.InputParameters AND context.ParentContext.InputParameters contain just "Target", and both "Target" refer to the same entity, which is the new one - not the one that was revised.

    The Plugin is running on Message=Create; Primary Entity=quote; PreOperation; Synchronous; Exec Order 1;

    Any suggestions on how to proceed? I'm unable to find any kind of reference to the revised entity, anywhere.

  • Verified answer
    a33ik Profile Picture
    84,331 Most Valuable Professional on at

    Hello,

    I just checked - try to check not the Parent Context but the Parent Context of Parent Context - that should give you the result.

  • DKasp Profile Picture
    229 on at

    Awesome, that was the key to solving this - thank you very much!

    Quick summary / snippet if anyone else runs into the same issue:

    IPluginExecutionContext context = (IPluginExecutionContext) serviceProvider.GetService(typeof(IPluginExecutionContext));
    Entity currentQuote = (Entity)context.InputParameters["Target"]; // new quote, based on the revised quote
    int revisionNumber = currentQuote.GetAttributeValue<int>("revisionnumber"); // only run this plugin if it's not the first draft of the quote
    if (revisionNumber > 0) {

    IPluginExecutionContext parentContext = context.ParentContext.ParentContext; // you need to go two "layers" deep to get to the revised quote
    if (parentContext.InputParameters.Contains("QuoteId")) { // and there it's no longer "Target" but "QuoteId"

    Guid revisedQuoteId = (Guid)parentContext.InputParameters["QuoteId"]; // and that's a Guid instead of an Entity
    // now you have both the revised as well as the new quote available for your code
    // revisedQuoteId contains the Guid of the revised quote, and currentQuote containing the entity record of the new quote

    // do stuff here

    }

    }

  • Dyname365 Profile Picture
    70 on at

    Anyone has luck locating this js? $webresource:Sales/_static/sfa/quotes/QuoteRibbonActions.js

  • a33ik Profile Picture
    84,331 Most Valuable Professional on at

    I believe you can easily do it using your browser:

    SalesJs.png

  • Dyname365 Profile Picture
    70 on at

    Thanks. Is there a way to easily format it so its readable again?

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 > 🔒一 Microsoft Dynamics CRM (Archived)

#1
SA-08121319-0 Profile Picture

SA-08121319-0 4

#1
Calum MacFarlane Profile Picture

Calum MacFarlane 4

#3
Alex Fun Wei Jie Profile Picture

Alex Fun Wei Jie 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans