locked
add a custom attribute that stores the various options that you want like Youth, Aged etc... so that when contact is less then 18 then display youth RRS feed

  • Question

  • hi there,

    How to add a custom field  to in form title to display like

    if contatact is less then 18 then disply  from mark smith   to mark smith(youth)

    Tuesday, October 1, 2013 9:06 PM

Answers

  • Please add the following code on load of contact:-

    function changeTitle(){
    if (Xrm.Page.getAttribute("birthdate").getValue() != null)
    {
    var date1 = Xrm.Page.getAttribute("birthdate").getValue();
    var date2 = new Date();
    //Set 1 day in milliseconds
    var one_day=1000*60*60*24
    //Calculate difference btw the two dates, and convert to days
    var difference = Math.ceil((date2.getTime()-date1.getTime())/(one_day))-5 ;
    var age = difference/365 ;
    var title= $(".ms-crm-Form-Title-Label");
    if (age >= 18){
    title[0].innerHTML = "Adult";
    }
    else {
    title[0].innerHTML = "Youth";
    }
    }
    }

    Please mark the question as completed if it fullfills your requirements. Shaukat

    Regards Faisal

    • Marked as answer by CRM20133 Wednesday, October 9, 2013 6:19 AM
    Wednesday, October 2, 2013 1:49 PM

All replies

  • Hi,

    You'll need to write some javascript to change the title. Please note that changing the title is unsupported.


    Kids don't try this at home!

    Wednesday, October 2, 2013 3:48 AM
  • Please add the following code on load of contact:-

    function changeTitle(){
    if (Xrm.Page.getAttribute("birthdate").getValue() != null)
    {
    var date1 = Xrm.Page.getAttribute("birthdate").getValue();
    var date2 = new Date();
    //Set 1 day in milliseconds
    var one_day=1000*60*60*24
    //Calculate difference btw the two dates, and convert to days
    var difference = Math.ceil((date2.getTime()-date1.getTime())/(one_day))-5 ;
    var age = difference/365 ;
    var title= $(".ms-crm-Form-Title-Label");
    if (age >= 18){
    title[0].innerHTML = "Adult";
    }
    else {
    title[0].innerHTML = "Youth";
    }
    }
    }

    Please mark the question as completed if it fullfills your requirements. Shaukat

    Regards Faisal

    • Marked as answer by CRM20133 Wednesday, October 9, 2013 6:19 AM
    Wednesday, October 2, 2013 1:49 PM