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)

want to pass 2 parameter at on-load in javascript function

(0) ShareShare
ReportReport
Posted on by 1,562

Hi all,

I am using a web-resource HTML type and want to pass 2 parameter at on-load in javascript function.

please suggest me how can i pass it as a querry sring here.

*This post is locked for comments

I have the same question (0)
  • Verified answer
    Bas van de Sande Profile Picture
    4,383 on at
    RE: want to pass 2 parameter at on-load in javascript function

    Hi Tin,

    in the other thread I answered the question on how to pass parameters from the ribbon. In this thread I'll try to answer your question on receiving the values

    In the form you can do something like this

    **

    * Get the value of a querystring

    * @param  {String} field The field to get the value of

    * @param  {String} url   The URL to get the value from (optional)

    * @return {String}       The field value

    */

    var getQueryString = function ( field, url ) {

       var href = url ? url : window.location.href;

       var reg = new RegExp( '[?&]' + field + '=([^&#]*)', 'i' );

       var string = reg.exec(href);

       return string ? string[1] : null;

    };

    Let’s say your URL is http://example.com&this=chicken&that=sandwich. You want to get the value of this, that, and another.

    var thisOne = getQueryString('this'); // returns 'chicken'

    var thatOne = getQueryString('that'); // returns 'sandwich'

    var anotherOne = getQueryString('another'); // returns null

    I hope this helps you further

    Bas

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…

Andrés Arias – Community Spotlight

We are honored to recognize Andrés Arias as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
Community Member Profile Picture

Community Member 2

#2
Christoph Pock Profile Picture

Christoph Pock 1

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans