locked
Can we add button to send mail RRS feed

  • Question

  • Hi,

    I have 4 tabs in form and want to add button on each tab. when user click on the button of the particular tab. details of that tab should send.  How can we do this in CRM.

    Regards,

    Noushad


    pnoushu@hotmail.com

    Tuesday, November 26, 2013 12:45 PM

Answers

  • I notice his example is built on Task.  Perhaps it is not valid for Email.  

    Did you check out CRM Nerd's implementation.  He has JS running onLoad:

    The following script can be used to retrieve the Custom Parameters and then use that information to set the regarding object on the appointment.

    function loadRegarding(){

    // Get the Value of the Regarding through the Customer Parameters

    var param=Xrm.Page.context.getQueryStringParameters();

    var regardingId=param["parameter_regardingid"];

    var regardingName=param["parameter_regardingname"];

    var regardingType=param["parameter_regardingtype"];

    //Populate the Regarding if there is one

    if (regardingId != undefined)

    {Xrm.Page.getAttribute(“regardingobjectid”).setValue([{id:regardingId, name:regardingName, entityType:regardingType}]);}

    }

    • Marked as answer by P Noushad Sunday, December 22, 2013 6:27 AM
    Wednesday, December 18, 2013 2:59 PM

All replies

  • Hi,

    Please check following link to create button on CRM Form:

    http://blog.customereffective.com/blog/2012/01/xrm-2011-crm-2011-style-buttons.html

    Create Email :

    http://mileyja.blogspot.in/2012/02/create-email-activity-in-microsoft.html

    Send Email :

    http://mileyja.blogspot.com/2012/02/send-email-synchronously-in-microsoft.html


    Hope this helps. If you get answer of your question, please mark the response as an answer and vote as helpful !!!
    Vikram Singh. !!!  My Blog

    Tuesday, November 26, 2013 12:56 PM
  • Hi,

    I want to send mail from custom entity by clicking on button.  I created custom entity, button.  When I click on the button it will call email activity.  I did set up default subject  as name of the account.  But I could not set regarding field by default.  I got error: Object expected when loading the form. Please help me to solve this issue.

    I have got few solution but it did not work.  Please find below the java code I have used for this.

    1.  I created 3 parameters. parameter_regardingid,parameter_regardingname,parameter_regardingtype on the form parameters as shown below screen-shot. Publish the form.

    2. I added below java code in form onload of custom entity and publish

    function Form_onload()
    {

    var param=Xrm.Page.context.getQueryStringParameters();
    var regardingId=param["parameter_regardingid"];
    var regardingName=param["parameter_regardingname"];
    var regardingType=param["parameter_regardingtype"];
    if (regardingId != undefined)
    {
    Xrm.Page.getAttribute(“regardingobjectid”).setValue([{id:regardingId, name:regardingName, entityType:regardingType}]);
    }

    }

    3. I added below java codes on button event.

    function sendmail()
    {

    var parameters = {};

    var Regarding = Xrm.Page.getAttribute(“regardingobjectid”).getValue();

    parameters["parameter_regardingid"] = Regarding[0].id;

    parameters["parameter_regardingname"] = Regarding[0].name;

    parameters["parameter_regardingtype"] = Regarding[0].entityType;

    Xrm.Utility.openEntityForm("email",null,parameters);

    }


    pnoushu@hotmail.com

    Tuesday, December 17, 2013 2:59 PM
  • I have found the same limitation.  I do not believe it is possible to set a Regarding field using URL parameters.  To get around this, I have created my own hidden custom field (new_tempRegarding) and passed in a string ("Acme Inc|23432-23423434-234-344".  When the page loads, javascript parses the field and sets the regarding.

    Tuesday, December 17, 2013 4:48 PM
  • Hi,

    Since email is common, I do not want to do any customization on email activity form.  let me know if any other solution.

    Regards,

    Noushad


    pnoushu@hotmail.com

    Wednesday, December 18, 2013 6:51 AM
  • It looks like Andrii found a way to set regarding:

    var params = {
        pId: referenced record id,
        pType: referenced record type code,
        pName: referenced record display name
    };

    Xrm.Utility.openEntityForm("task", null, params);

    I dare say it's not "supported"...

    Wednesday, December 18, 2013 12:49 PM
  • Hi,

    I have gone through Andrii document but I got above mentioned error.  Can you give in detailed solution.

    Regards,

    Noushad


    pnoushu@hotmail.com

    Wednesday, December 18, 2013 1:13 PM
  • I notice his example is built on Task.  Perhaps it is not valid for Email.  

    Did you check out CRM Nerd's implementation.  He has JS running onLoad:

    The following script can be used to retrieve the Custom Parameters and then use that information to set the regarding object on the appointment.

    function loadRegarding(){

    // Get the Value of the Regarding through the Customer Parameters

    var param=Xrm.Page.context.getQueryStringParameters();

    var regardingId=param["parameter_regardingid"];

    var regardingName=param["parameter_regardingname"];

    var regardingType=param["parameter_regardingtype"];

    //Populate the Regarding if there is one

    if (regardingId != undefined)

    {Xrm.Page.getAttribute(“regardingobjectid”).setValue([{id:regardingId, name:regardingName, entityType:regardingType}]);}

    }

    • Marked as answer by P Noushad Sunday, December 22, 2013 6:27 AM
    Wednesday, December 18, 2013 2:59 PM
  • Hi,

    I used the same codes. Please read the mail from the begining. I have given the codes I used step by step.

    I am getting the problem when it reach on below code.  I have given this code on form load event of custom entity. but it give error when load form at the below mentioned line.

    Xrm.Page.getAttribute(“regardingobjectid”).setValue([{id:regardingId, name:regardingName, entityType:regardingType}]);


    pnoushu@hotmail.com

    Thursday, December 19, 2013 1:32 PM
  • I saw your code...you are reading the parameters in the OnLoad of the custom entity, but you should be reading them in the OnLoad of the Email form.
    • Marked as answer by P Noushad Sunday, December 22, 2013 10:24 AM
    • Unmarked as answer by P Noushad Sunday, December 22, 2013 10:24 AM
    Thursday, December 19, 2013 7:11 PM
  • Hi,

    I have read regarding prameters in email entity also.  but I got the same error.  I will appreciate if anybody can give me step by step solution for this.  If you give step by step solution I can easly find if there is any issue in my coding.

    Regards,

    Noushd

     


    pnoushu@hotmail.com

    Sunday, December 22, 2013 10:44 AM