Skip to main content

Posts

Showing posts from June, 2021

PMT Calculation via JS

  // Function to calculate Periodic Payments. function   pmt ( rate ,  per ,  nper ,  pv ,  fv ) {      fv  =  parseFloat ( fv );      nper  =  parseFloat ( nper );      pv  =  parseFloat ( pv );      per  =  parseFloat ( per );      if  (( per  ==  0 ) || ( nper  ==  0 )) {          alert ( "Why do you want to test me with zeros?" );          return  ( 0 );     }      rate  =  eval (( rate ) / ( per  *  100 ));      if  ( rate  ==  0 )  // Interest rate is 0     {   ...

JS retrieve multiple with FetchXML

"; fetchXml = "?fetchXml=" + encodeURIComponent(fetchXml); Xrm.WebApi.retrieveMultipleRecords("account", fetchXml).then( function success(result) { for (var i = 0; i var fetchXml = "<fetch mapping='logical'><entity name='account'><attribute name='accountid'/><attribute name='name'/></entity></fetch>" ; fetchXml = "?fetchXml=" + encodeURIComponent (fetchXml); Xrm.WebApi.retrieveMultipleRecords( "account" , fetchXml).then( function success ( result ) { for ( var i = 0 ; i < result.entities.length; i++) { console .log(result.entities[i]); } // perform additional operations on retrieved records }, function ( error ) { console .log(error.message); // handle error conditions } );

Js Code for auto populate lookup on a create from a subgrid in Power Portal

$ ( document ). ready ( function  () {          var   url  =  window . location . href ;      var   id  =  getParameterByName ( "id" ,  url );      var   name  =  $ ( "#msnfp_name" ). val ();      localStorage . setItem ( "id" ,  id );      localStorage . setItem ( "name" ,  name );      function   getParameterByName ( name ,  url ) {          if  (! url )  url  =  window . location . href ;          name  =  name . replace ( / [ \[\] ] / g ,  " \\ $&" );          var   regex  =  new   RegExp ( "[?&]"  +  name  +  "(=([^&#]*)|&|#|$)" ),    ...