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

How to set session timeout in MS Dynamics CRM Portals in Web Templates

(0) ShareShare
ReportReport
Posted on by 266

Hi All,

Can anyone tell me how to set the session time out in MS Dynamics Portals. I dont want to set it for Global level but for a specific page from which i am calling a third party URL. Problem is if i dont get a response from the third party server then the page keeps on showing the loading symbol, to control this behavior i want to implement the timeout for that page. Quick help would be appreciated guys. Also, is there any setting at web page level for setting timeout.

Thanks in advance

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    oliver.rodrigues Profile Picture
    4,052 on at
    RE: How to set session timeout in MS Dynamics CRM Portals in Web Templates

    to set in the entire Portal you can do it through the Site Settings

    docs.microsoft.com/.../set-authentication-identity

    but as you want just in one page.. what I would do is set a JavaScript timeout in your function that you call your integration.. display a message and finally redirect to the signout page.. this will log the user out of the system

    setTimeout(function(){ alert("Hello"); }, 3000);

  • dhawal Profile Picture
    266 on at
    RE: How to set session timeout in MS Dynamics CRM Portals in Web Templates

    Thanks oliver!!! Can you please help me to understand the timeout value takes milliseconds right? So if i want to set a timeout for 2 minutes the value will be 120000 correct?

  • Suggested answer
    oliver.rodrigues Profile Picture
    4,052 on at
    RE: How to set session timeout in MS Dynamics CRM Portals in Web Templates

    yes that's correct.. it is in milliseconds

    and after that you redirect to:

    /Account/Login/Logoff

    or if you prefer to go to a certain page

    /Account/Login/LogOff?returnUrl=/your-page-partial-url

  • dhawal Profile Picture
    266 on at
    RE: How to set session timeout in MS Dynamics CRM Portals in Web Templates

    Thanks oliver appreciate your prompt response on my query.. Can you also help me out with the below scenario :

    I am trying to apply the timeout logic on a web template and i am passing a query string in the URL which i want to redirect to after the session time out and want to display a message based on the query string using request.params['id'] but i am not able to do that. Can you please let me know how can i achieve this?

  • Suggested answer
    oliver.rodrigues Profile Picture
    4,052 on at
    RE: How to set session timeout in MS Dynamics CRM Portals in Web Templates

    hello again

    I just created a simple page with custom web template

    I had an issue once trying to use the JS request in the Portal from Web Template, so what I ended up using was creating hidden elements through Liquid

     <input type="hidden" id="CaseId" value="{{ request.params.id }}"/>

    and then you can use the normal document.getElementById in the JS

    if this doesn't solve your issue please share your codec.. if it does please mark the answer as verified

    thanks

    {% extends 'Layout 1 Column' %}

    {% block main %}

     {% include 'Page Copy' %}

     {% if page.adx_entityform %}

       {% entityform id: page.adx_entityform.id %}

     {% endif %}

     <input type="hidden" id="CaseId" value="{{ request.params.id }}"/>

    <script>

     $(document).ready(function () {

       setTimeout(function(){

           var caseId = document.getElementById("CaseId").value;

           if (caseId === "bfa66943-25ff-e811-a994-000d3ab78efb")

             alert("you will be redirected...");

           else

             alert("you won't be redirected..");

         }, 3000);

     });

    </script>

    {% endblock %}

  • dhawal Profile Picture
    266 on at
    RE: How to set session timeout in MS Dynamics CRM Portals in Web Templates

    Hi Oliver, first of all wish you merry christmas..... :)

    Below is what i am trying to do :

    From one of my Web Templates i am trying to run session time out code like below :

    setTimeout(function () { window.open("https://" + window.location.host + "/transaction-status/?s=1", "_self"); }, {{sessionValue}});

    In the above code i am passing a query string "?s=1" and want to redirect to a different page/Web Template in which i will checked like below :

    {% if request.params['s'] %}

               IN SESSION CHECK BLOCK

               <div class="col-lg-6 col-md-6 col-sm-8 col-xs-10 col-lg-offset-3 col-md-offset-3 col-sm-offset-2 col-xs-offset-1 confHeader" style="margin-top:6%;">

                   <div class="fontcls">Session Time Out</div>

               </div>

               <div class="col-lg-6 col-md-6 col-sm-8 col-xs-10 col-lg-offset-3 col-md-offset-3 col-sm-offset-2 col-xs-offset-1 divCls" style="display:block;">

                   <div class="">

                       {% editable snippets "registrationsessiontimeouttitle" type: 'text' , default:'Session Timed out. Transaction status will be Pending. Kindly contact AIMS Adminstrator.' %}

                   </div>

               </div>

    {% endif %}

    but above code and message is not displayed. It just shows blank page, also i tried storing the value of querystring in a variable and using the variable, still doesnt work..!!! Can you help out here?

  • Suggested answer
    Shaminderpal Singh Profile Picture
    1,565 on at
    RE: How to set session timeout in MS Dynamics CRM Portals in Web Templates

    Hi,

    I believe in your scenario it would be best to set the specified timeout in your web service ajax call. You can easily set it in jquery and redirect it in error response.

    stackoverflow.com/.../set-timeout-for-ajax-jquery

    -Shaminder

  • dhawal Profile Picture
    266 on at
    RE: How to set session timeout in MS Dynamics CRM Portals in Web Templates

    Hi Shaminder, Thanks for the response!! Actually i cannot write any code in the web service as its third party and i am not the one who is managing the code. That's the reason i wanted to implement the Session Time out in my code. If you have any other insight on this please do comment with the probable solution.

  • Suggested answer
    Shaminderpal Singh Profile Picture
    1,565 on at
    RE: How to set session timeout in MS Dynamics CRM Portals in Web Templates

    I assume you are making web service call in JavaScript . I was asking to specify timeout in xmlhttprequest which you are making from portal code. We don't need to make any changes in web service code.

    Let me know if you need further info

    -shaminder

  • dhawal Profile Picture
    266 on at
    RE: How to set session timeout in MS Dynamics CRM Portals in Web Templates

    Okay I have already written the session timeout code. The place where i am stuck is on one single Web Template i am not able to use multiple request.params? Do you know why

    ?

    setTimeout(function () { window.open("https://" + window.location.host + "/transaction-status/?s=1", "_self"); }, {{sessionValue}}); -- This code sets the session timeout and then i am redirecting to a page with query string s=1

    and when i try to check for the query string on a different page which i am redirecting to

    {% if request.params['s'] %}

    i am not able to check for the query string because there are already two request.params being used on the page. I have no idea why we cant use multiple query strings on one page. :( can you help me out how can i set the request.params['s'] value from one page to other.

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
Wayne Walton Profile Picture

Wayne Walton 2

#2
Good.Panos Profile Picture

Good.Panos 1

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans