<html><head>
<script src="ClientGlobalContext.js.aspx"></script>
<script type="text/javascript" src="north52_/javascript/wijmo/jquery"></script>
<script type="text/javascript" src="north52_/javascript/wijmo/jqueryui"></script>
<script type="text/javascript" src="north52_/javascript/north52.htmlwebresource.helper"></script>
<script type="text/javascript" src="north52_/javascript/north52_dialog_helper"></script>
<script type="text/javascript" src="north52_/javascript/editor/sourceentity"></script>

<title>North52 BPA</title>
<style type="text/css">
	body {
		background: #eee; 
		padding: 30px;
		font-family: "Segoe UI",Arial,Sans-Serif;
	}
		
	.column1 {
		width: 300px;
		float: left;
		padding-right: 50px;
	}
	.column2 {

	}
	.splash-select {
		width: 100%;
		padding: 5px;
		font-size: 18px;
	}
	h1 {font-size: 23px;
		font-weight: normal;
		font-style: italic;
		margin:0;
		padding: 10px 0;
	}
	h2 {font-size: 20px;
	}

    .formuladesc{
        padding: 20px 10px;
        display: none;
    }
	label > input{ /* HIDE RADIO */
	  visibility: hidden; /* Makes input not-clickable */
	  position: absolute; /* Remove input from document flow */
	}
	label > input + img{ /* IMAGE STYLES */
	  cursor:pointer;
	  border:1px solid rgba(0, 0, 0, 0.25);
	}
	label > input:checked + img{ /* (RADIO CHECKED) IMAGE STYLES */
	  border:2px solid #cc0000;
	}
	
</style>

<script type="text/javascript">


       function N52Sort (a, b) {  
	   
	   if (a.innerHTML == 'All Properties') {
	       return -1;
	  }
	  else if (b.innerHTML == 'All Properties') {
	     return 1;
	  }	
	  return (a.innerHTML > b.innerHTML ) ? 1 : -1;
	};


     function Load() {

           var CacheKey = 'EntityList52' + window.parent.Xrm.Page.context.getOrgUniqueName();
            if (localStorage.getItem(CacheKey ) != null)
            {
            	var entityMetadataCollection = JSON.parse(localStorage.getItem(CacheKey ));
            	
            	 for (var i = 0; i < entityMetadataCollection.length; i++)
                      {   
	           var splitArray = entityMetadataCollection[i].split('|');
	           var label =  splitArray[0]; 
	           var logicalname =  splitArray[1]; 
				
	           N52.HTMLWebResourceHelper.InsertOptionSetItem("sourceentity", label,logicalname);   
	}

                    $("#sourceentity option").sort(N52Sort).appendTo("#sourceentity");
                    $('#loading-sourceentity').hide(); 
  	$("#sourceentity").val('account');
            }
            else
             {
	setTimeout(function(){ Load(); }, 3000); 
             }
        };


$(document).ready(function(){

     $('#formulaType').val(parent.$("#formulaType").val());
     Load();	

    $("#formulaType").change(function(){
        $(this).find("option:selected").each(function(){
            if($(this).attr("value")=="217890005"){
                $(".formuladesc").not(".217890005").hide();
                $(".217890005").show();
            }
            else if($(this).attr("value")=="217890000"){
                $(".formuladesc").not(".217890000").hide();
                $(".217890000").show();
            }
            else if($(this).attr("value")=="217890014"){
                $(".formuladesc").not(".217890014").hide();
                $(".217890014").show();
            }
			else if($(this).attr("value")=="217890015"){
                $(".formuladesc").not(".217890015").hide();
                $(".217890015").show();
            }
			else if($(this).attr("value")=="217890017"){
                $(".formuladesc").not(".217890017").hide();
                $(".217890017").show();
            }
			else if($(this).attr("value")=="217890018"){
                $(".formuladesc").not(".217890018").hide();
                $(".217890018").show();
            }
			else if($(this).attr("value")=="217890019"){
                $(".formuladesc").not(".217890019").hide();
                $(".217890019").show();
            }
			else if($(this).attr("value")=="217890016"){
                $(".formuladesc").not(".217890016").hide();
                $(".217890016").show();
            }
			else if($(this).attr("value")=="217890013"){
                $(".formuladesc").not(".217890013").hide();
                $(".217890013").show();
            }
			else if($(this).attr("value")=="217890003"){
                $(".formuladesc").not(".217890003").hide();
                $(".217890003").show();
            }
			else if($(this).attr("value")=="217890001"){
                $(".formuladesc").not(".217890001").hide();
                $(".217890001").show();
            }
			else if($(this).attr("value")=="217890004"){
                $(".formuladesc").not(".217890004").hide();
                $(".217890004").show();
            }
            else{
                $(".formuladesc").hide(); 
            }
        });
    }).change();
});
</script>
<meta>
<meta charset="utf-8"></head><body>
	<div class="column1">
	<h1>1. Select Entity</h1> 
	
	
	  <div id="loading-sourceentity"> 
	  	<img style="float: left;" id="loading-image-sourceentity" alt="Loading" src="north52_image_progress"> 
	  </div>

      <div id="main-sourceentity">
         <select id="sourceentity" class="splash-select"></select> 
      </div>
    
	
	<br>
	<br>
	
	<h1>2. Select Formula Type</h1>
	<div class="controls">
	<select id="formulaType" class="splash-select">   
		<option value="217890005">Auto Number</option>
		<option value="217890000">Calculated Field</option>
		<option value="217890014">ClientSide - Calculation</option>
		<option value="217890015">ClientSide - Perform Action</option>
		<option value="217890017">Command Console</option>
		<option value="217890018">N:N Associate</option>
		<option value="217890019">N:N Disassociate</option>
		<option value="217890016">Process Genie</option>
		<option value="217890013">Save - Perform Action</option>
		<option selected="" value="217890003">Save - To Current Record</option>
		<option value="217890001">Save - To Parent</option>
		<option value="217890004">Validation</option>
	</select>

    </div>
    <div class="217890005 formuladesc">When you need to generate an auto number of your desired format which increments by defined value.</div>
    <div class="217890000 formuladesc">When all you need is to display the results of a formula on an entity form. It is not persisted and is calculated on load of the form.</div>
    <div class="217890014 formuladesc">Executes a formula on the client side which can be used with other JavaScript code.</div>
	<div class="217890015 formuladesc">Allows you to perform a client side action such as hide tabs, show form notifications, set field focus, etc. This is the most common client side formula type.</div>
	<div class="217890017 formuladesc">Allows you to manually execute any ad-hoc formulas against your CRM system.  Ideal when you just want to update some data within your CRM system.</div>
	<div class="217890018 formuladesc">Allows you to execute a formula whenever a many to many relationship is created.</div>
	<div class="217890019 formuladesc">Allows you to execute a formula whenever a many to many relationship is removed.</div>
	<div class="217890016 formuladesc">Allows you to execute a formula as part of a dialog, workflow (realtime or async.) or an action.</div>
	<div class="217890013 formuladesc">When you want to execute a formula on the Save event of a record.</div>
	<div class="217890003 formuladesc">When you need the result of the formula to be saved to a specific field on the current record. If you need to save to multiple fields use the Save - Perform Action formula type.</div>
	<div class="217890001 formuladesc">When you need the result of the formula to be saved to a specific field on the parent record of the source record. These are typically for N:1 relationships.</div>
	<div class="217890004 formuladesc">Select this option when you need to provide validation of data within fields. This allows you to stop a user from entering in data on a form unless is passes your data validation requirements. When set to Server Side the validation will also occur for data being updated via import functionality or the API (e.g. portal).</div>

<br><br>
	<input id="n52showformulawizard" onchange="if (n52showformulawizard.checked) localStorage.setItem('n52showformulawizard', 'n52showformulawizard'); else localStorage.removeItem('n52showformulawizard');" name="n52showformulawizard" value="n52showformulawizard" type="checkbox">Do not show Formula Guide again.<br>
	
	</div>
	<div class="column2">
	<div style="display: table-cell;">
	<h1>3. Select Editor</h1>
	
	<div style="width: 400px; text-align: center; float: left; display: table-cell;">
	<h2>Classic</h2>
		<label>
		<input id="rbclassic" name="fb" value="small" CHECKED="checked" type="radio">
		<img style="width: 350px;" src="north52_image_classiceditor">
	  </label>
	</div>
	
	<div style="width: 400px; text-align: center; float: right; display: table-cell;">
	<h2>Decision Table</h2>
		<label>
		<input id="rbdecision" name="fb" value="big" type="radio">
		<img style="width: 350px;" src="north52_image_decisioneditor">
	  </label>
	</div>
	</div>
	</div>

  </body></html>