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)

Shared variable

(0) ShareShare
ReportReport
Posted on by 70

Hello Guys,

Can anyone explain me the concept of shared variable in D365?

ExecutionContextObj.getSharedVariable(key)

ExecutionContextObj.setSharedVariable(key, value)

I have a requirement in which I have to make a subgrid say "Address" on Account form and using the concept of shared variable I have to pass value from Account to the subgrid record? Can anyone please explain how to implement this.

Thanks in advance :)

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    Rawish Kumar Profile Picture
    13,758 on at

    I tried to explain what is get/set shared variable in JS here : community.dynamics.com/.../289043

    Also here is another blog : sliong.wordpress.com/.../crm-2011-execution-context-javascript-shared-variable

    if i understand your requirement correctly  - you need to update child records using some values from account record. To do this you can simply a write  simple javascript using WEB API aspsolutionkirit.blogspot.com/.../how-to-retrieves-all-child-contacts-of.html or simple plugin.

  • priyanka_24 Profile Picture
    70 on at

    Hi Rawish,

    I can update using web api but the requirement is to use the concept of shared variable to set value in child record?

  • Suggested answer
    Rawish Kumar Profile Picture
    13,758 on at

    Okay, I have not seen the concept set/get sharedvariable being used for updating child record.

    During a event execution the formcontext is passed to various event handlers and within those event handlers you can make use of sharedvariable.

    To be honest - they are just to 'set' a variable in an event and later 'get' it  - cannot be used to CRUD operations as such.  

    the requirement doesnt make sense as all you have to do is retrieve the ID of the parent and do a simple retrievemultiple ap request and update records.

  • priyanka_24 Profile Picture
    70 on at

    Okay, can you demonstrate by giving a simple scenario for shared variable?

  • Suggested answer
    Rawish Kumar Profile Picture
    13,758 on at

    Hi Priyanka,

    Looks like i am very bad at explaining. Let me try again.

    if you are aware of shared variable concept in dynamics CRM plugins where in you can set a variable and later use it in the plugins registered on the same event in dynamics crm.

    similar way a shared variable can be set and used amongst functions being called on same events in javascripts.

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