Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

USD : Creating a replacement parameter for each session

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

Hi, Can we create a replacement parameter for a session, which can hold some temporary value, based on which some actions cannot be called again and again?

*This post is locked for comments

  • Kaustubh Hegde Profile Picture
    Kaustubh Hegde 330 on at
    RE: USD : Creating a replacement parameter for each session

    There are multiple ways of handling this. Like Neil suggested, you can run an action to do CopyToContext which will copy your data to "$Context" section.

    Else if you are doing this for a specific hosted control inside C# code, you can copy the data to the specific hosted control. Below is the code to do the same.

    1. If your Hosted Control is global hosted control :

    var parameters = new Dictionary<string, CRMApplicationData>();

                       parameters.Add(Constants.usdParameterName, new CRMApplicationData() { name = <<Name of the Parameter>>, type = "string", value = <<Value to add>> });

    ((DynamicsCustomerRecord)((AgentDesktopSession)localSessionManager.GlobalSession).Customer.DesktopCustomer).MergeReplacementParameter("Name of Hosted Control", parameters, true);

    2. If your Hosted Control is not Global

    var parameters = new Dictionary<string, CRMApplicationData>();

                       parameters.Add(Constants.usdParameterName, new CRMApplicationData() { name = <<Name of the Parameter>>, type = "string", value = <<Value to add>> });

    ((DynamicsCustomerRecord)((AgentDesktopSession)localSessionManager.ActiveSession).Customer.DesktopCustomer).MergeReplacementParameter("Name of Hosted Control", parameters, true);

  • Verified answer
    Neil Parkhurst Profile Picture
    Neil Parkhurst 10,727 User Group Leader on at
    RE: USD : Creating a replacement parameter for each session

    We have a concept of CopyToContext, have you looked at that?

    neilparkhurst.com/.../usd-copytocontext

    Each session has a context, essentially some replacement parameters that relate to the current session. A CopyToContext action lets us copy a parameter into that context that can then be used / re used. Something like "[[$Context.MyParameterName]]".

    Failing that you could look at the SaveSetting concept.

    neilparkhurst.com/.../usd-savesetting

    This allows us to save a user setting. User settings are retained and not "just" related to the current session. You'd read one of those with syntax like "[[$Settings.MyParameterName]]".

    Hopefully one of these approaches will answer you question.

  • ansrikanth Profile Picture
    ansrikanth 3,115 on at
    RE: USD : Creating a replacement parameter for each session

    What do you mean by Replacement parameter for a session?

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

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Vahid Ghafarpour – Community Spotlight

We are excited to recognize Vahid Ghafarpour as our February 2025 Community…

Tip: Become a User Group leader!

Join the ranks of valued community UG leaders

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 292,494 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 231,309 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans