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

Community site session details

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

Catch parent execution context id

(0) ShareShare
ReportReport
Posted on by 92

Hello,

I hope someone will help me with my quest.

I created a plugin for quotes in CRM to retrieve the parent guide when the quote is revised. when I retrieve the parent execution context, I get the new quote id that was created.

I registered this plugin on the pre-operation create of the quote table.

In the screenshot below I used context.ParentContext to get the parent of the record created, but the parent guide is returning the new GUID created and not the parent one.

pastedimage1674209471606v1.png

I tried to use the context.ParentContext.ParentContext (grandparent method) but the GUID is returning all 0s.

Can someone assist me to get the GUID of the revised quote?

Thank you in advance!

I have the same question (0)
  • Suggested answer
    Pradeep Rai Profile Picture
    5,489 Moderator on at
    RE: Catch parent execution context id

    Hi,

    I would suggest you can retrieve the quote record using the QUOTEID and Status as Closed.

    because when we revise the quote then New Quote Created and Old Quote Status Changes to Revised.

    Also, try below code:

    context.ParentContext.ParentContext.InputParameters.InputParameters("QuoteId")

    Found in below discussion:

  • MBaba Profile Picture
    92 on at
    RE: Catch parent execution context id

    Hello Pradeep Rai ,

    Thank you for the fast reply. I tried to use context.ParentContext.ParentContext.InputParameters.InputParameters("QuoteId") but it is throwing a syntax error in visual studio

  • Suggested answer
    Naveen Ganeshe Profile Picture
    3,397 User Group Leader on at
    RE: Catch parent execution context id

    Hi,

    Looks like you have quote no. in the plugin for the previous quote. You can search the quote by quote no. where the status is closed. This way you can get the quoteId.

  • Pradeep Rai Profile Picture
    5,489 Moderator on at
    RE: Catch parent execution context id

    I agreed with Naveen.

  • MBaba Profile Picture
    92 on at
    RE: Catch parent execution context id

    Hello Naveen Ganeshe ,

    I want to get the revised quote not closed.

    For example, I have 4 closed quotes (1,2,3,4) but I want to revise the 2nd quote and get its child records to the new quote.

    The problem is I'm not able to get the GUID from the Parent context and I cannot filter on last number revised neither on last modified.

    The best practice is to catch the GUID of the parent record, but this approach is not working.

    Thank you

  • Suggested answer
    Pradeep Rai Profile Picture
    5,489 Moderator on at
    RE: Catch parent execution context id

    Hi,

    let's consider below example.

    pastedimage1674221016304v2.png

    Suppose, You are Revising the Quote B
    Then logic will on Create of Quote

    1. Get Quote Number of Quote
    2. Get Quote Revision Number
    3. Now substract the Revision with 1
    4. Now you can search for Quote Record where Quote Number eq "<value found in step 1>" and Revision Number eq "Value found in step 3".

    This you will have previous record.

    Other way is you can retrieve latest record from "Quote Close" entity based created on.



    pastedimage1674220987436v1.png

  • MBaba Profile Picture
    92 on at
    RE: Catch parent execution context id

    Hello Pradeep Rai ,

    \In the case you shared, you are assuming that the last product is always being revised. In that way, it will work, but I mean if the revised quote is not the last one. Getting quote no. and decrementing the revision by one is not the solution, in this case, that's why I want to get the GUID of the revised quote.

    Thank you

  • Pradeep Rai Profile Picture
    5,489 Moderator on at
    RE: Catch parent execution context id

    Right.

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 179 Super User 2025 Season 2

#2
#ManoVerse Profile Picture

#ManoVerse 110

#3
Gerardo Rentería García Profile Picture

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

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans