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)

Execute Method Available in JScript Web resource when User logs in the System

(0) ShareShare
ReportReport
Posted on by 265

Hi,

   I want to execute some jscript methods available in webresource when user logs in to Dynamic CRM. Can you please guide me how to implement this?

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    ScottDurow Profile Picture
    21 on at
    RE: Execute Method Available in JScript Web resource when User logs in the System

    Hi,

    There are two challenges you have:

    1. Detecting when a user has logged on - Within Dynamics CRM there isn't a specific client side event that you can hook into when a user logs on. The best you can do is to store the last time a user was active and then use a 'timeout' window to decide if they are no longer logged in - you can then reset that timeout with every request.

    2. Running Javascript on a non-form page. Since the user will most likely access a non-form page as their first page, you'll need to create some Javascript that is run from the ribbon as an Enable Rule on the HomePage ribbon.. EnableRule Javascript rules are run when the page is rendered.

    What is your use-case? Is there a different approach you can take since your scenario doesn't really fit with the recommended extension points of Dynamics CRM.

    Hope this helps,

    Scott

  • Verified answer
    Vijay Waghmare Profile Picture
    on at
    RE: Execute Method Available in JScript Web resource when User logs in the System

    Create a JS web resource and add it to Application Ribbon. Once you added this to application Ribbon, JS will hit on all pages including all entities, dashboard etc

    In JS file you can have onload event as below to perform any operation on page load (no manual triggering point required). You can get a Xrm object here

    window.onload=function(){

    // perform your JS opertation here

    }

    Thanks,

    Vijay Waghmare

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…

Pallavi Phade – Community Spotlight

We are honored to recognize Pallavi Phade as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
Community Member Profile Picture

Community Member 2

#1
UllrSki Profile Picture

UllrSki 2

#3
SC-08081331-0 Profile Picture

SC-08081331-0 1

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans