locked
How to change FormType value in a form RRS feed

  • Question

  • Hello all,

    I have a customize buttom in the email form which creates one activity using javascript logic.  Something like:

    "    <Create xmlns=\"http://schemas.microsoft.com/crm/2007/WebServices\">" +
                "      <entity xmlns:q1=\"http://schemas.microsoft.com/crm/2006/WebServices\" xsi:type=\"q1:DynamicEntity\" Name=\"email\">" +
                "        <q1:Properties>" +
                "          <q1:Property xsi:type=\"q1:OwnerProperty\" Name=\"ownerid\">" +
                "            <q1:Value>" + vownerId + "</q1:Value>" +
                "          </q1:Property>";
                if (regardingobjectid != "") {
                    xmlCreateEmail = xmlCreateEmail +
                "          <q1:Property xsi:type=\"q1:LookupProperty\" Name=\"regardingobjectid\">" +
                "            <q1:Value type=\"" + regardingobjecttypename + "\">" + regardingobjectid + "</q1:Value>"
                }
                xmlCreateEmail = xmlCreateEmail +
            "          </q1:Property>" +
            "        </q1:Properties>" +
            "      </entity>" +
            "    </Create>" +

    It works normally, however when user clicks save icon in form interface,  another activity is created. How can I change formtype which is originally 1 to 2. I tried using

    crmForm.FormType = 2; but it stills creates another activity.

    Any clues ?

     


    Yojan
    Thursday, February 25, 2010 10:58 PM

Answers

  • The FormType property is Read Only and cannot be set.  Is your button an ISV button?  If so, you can set the ISV button property to only show up on the form when it's in UpdateMode instead of CreateMode

    • Marked as answer by Yojan Friday, February 26, 2010 2:37 PM
    Friday, February 26, 2010 12:09 AM
  • crmForm.FormType property tell you whether your form is create or update ..etc....this is readonly property you will not able to chnage it..

    if you want to just create a activity or run your logic which creating Email then first check if form type is create then run the logic other wise not..

    foe example..

     if (crmForm.FormType ==1)
     {
        //you logic
     }


    this will insure logic run only when new email gets created..


    • Marked as answer by Yojan Friday, February 26, 2010 2:37 PM
    Friday, February 26, 2010 10:17 AM

All replies

  • Hello all,

    I have a customize buttom in the email form which creates one activity using javascript logic.  Something like:

    "    <Create xmlns=\"http://schemas.microsoft.com/crm/2007/WebServices\">" +
                "      <entity xmlns:q1=\"http://schemas.microsoft.com/crm/2006/WebServices\" xsi:type=\"q1:DynamicEntity\" Name=\"email\">" +
                "        <q1:Properties>" +
                "          <q1:Property xsi:type=\"q1:OwnerProperty\" Name=\"ownerid\">" +
                "            <q1:Value>" + vownerId + "</q1:Value>" +
                "          </q1:Property>";
                if (regardingobjectid != "") {
                    xmlCreateEmail = xmlCreateEmail +
                "          <q1:Property xsi:type=\"q1:LookupProperty\" Name=\"regardingobjectid\">" +
                "            <q1:Value type=\"" + regardingobjecttypename + "\">" + regardingobjectid + "</q1:Value>"
                }
                xmlCreateEmail = xmlCreateEmail +
            "          </q1:Property>" +
            "        </q1:Properties>" +
            "      </entity>" +
            "    </Create>" +

    It works normally, however when user clicks save icon in form interface,  another activity is created. How can I change formtype which is originally 1 to 2. I tried using

    crmForm.FormType = 2; but it stills creates another activity.

    Any clues ?

     

     


    Yojan
    Thursday, February 25, 2010 10:54 PM
  • Can you explain some more please. Do you have code in the onsave to use this create funciton?
    MSCRM Bing'd - http://bingsoft.wordpress.com
    Thursday, February 25, 2010 11:25 PM
    Moderator
  • The FormType property is Read Only and cannot be set.  Is your button an ISV button?  If so, you can set the ISV button property to only show up on the form when it's in UpdateMode instead of CreateMode

    • Marked as answer by Yojan Friday, February 26, 2010 2:37 PM
    Friday, February 26, 2010 12:09 AM
  • crmForm.FormType property tell you whether your form is create or update ..etc....this is readonly property you will not able to chnage it..

    if you want to just create a activity or run your logic which creating Email then first check if form type is create then run the logic other wise not..

    foe example..

     if (crmForm.FormType ==1)
     {
        //you logic
     }


    this will insure logic run only when new email gets created..


    • Marked as answer by Yojan Friday, February 26, 2010 2:37 PM
    Friday, February 26, 2010 10:17 AM