0% found this document useful (0 votes)
70 views

Function If Null: "New - City"

The document contains JavaScript functions for a Microsoft Dynamics CRM form: 1) The getcityfielddata function retrieves the value of the "new_city" field if it exists on the form. 2) The setcityfielddata function, meant to be called on form save, sets the "new_city" field to a default value of "Chennai" if it is empty. 3) The showandhidesectionsbasedoncustomer function handles showing and hiding sections on a form tab based on the value selected in the "icici_customertype" field, displaying either an individual or corporate section as appropriate.

Uploaded by

Hemanth Kumar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
70 views

Function If Null: "New - City"

The document contains JavaScript functions for a Microsoft Dynamics CRM form: 1) The getcityfielddata function retrieves the value of the "new_city" field if it exists on the form. 2) The setcityfielddata function, meant to be called on form save, sets the "new_city" field to a default value of "Chennai" if it is empty. 3) The showandhidesectionsbasedoncustomer function handles showing and hiding sections on a form tab based on the value selected in the "icici_customertype" field, displaying either an individual or corporate section as appropriate.

Uploaded by

Hemanth Kumar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

Get City Field

function getcityfielddata() {
//debugger;
if (Xrm.Page.getAttribute("new_city") != null) //verify the field is presented on the
form or not
{
if (Xrm.Page.getAttribute("new_city").getValue() != null)////if the field is
presented on the form then check the value of the filed whether value is there ot not
{
var cityValue = Xrm.Page.getAttribute("new_city").getValue();
alert(cityValue);
}

Set City field

//bind the function to onsave if user forget to enter city then by defauly city value
should set
function setcityfielddata()
{

var Cityname = Xrm.Page.getAttribute("new_city").getValue();


if (Cityname == null)
{
Xrm.Page.getAttribute("new_city").setValue("Chennai");

showandhidesectionsbasedoncustomer

//just bind this function Onchange event Of Customer Type

function showandhidesectionsbasedoncustomer() {

debugger;

var customertypeValue = Xrm.Page.getAttribute("icici_customertype").getValue();

var customertypename = Xrm.Page.getAttribute("icici_customertype").getText();

if (customertypename == "Individual") {

//here

HideShowSection("tab_2", "tab_2_section_2", false);//hide the corporate section

HideShowSection("tab_2", "tab_2_section_1", true);//show the individual section


}

if (customertypename == "Corporate") {

HideShowSection("tab_2", "tab_2_section_1", false);//hide the individual section

HideShowSection("tab_2", "tab_2_section_2", true);//show the corporate section

You might also like