Set Email Description (body) with javascript

I am trying to set the Email description in the OnLoad event of the email form in CRM 2011
Using this code:
"Xrm.Page.getAttribute("description").setValue(mailText.toString());"
In OnLoad of the email form my script is excecuted every time it loads / refreshes the page but the description is sometimes shown and sometimes not.
Does somebody know about this behavior and may have a solution?
Greez

Thx for your reply. The rest of the code is working. I debuged it about 1000 times. :)
But here it is:
function FillEmail()
var lookup = new Array();
regObj = Xrm.Page.getAttribute("regardingobjectid").getValue();
if (regObj != null)
if (regObj[0].entityType == "new_besuchsbericht")
var bericht = CrmRestKit.Retrieve("new_besuchsbericht", regObj[0].id, [
"new_name",
"OwnerId",
"new_OrtdesBesuchs",
"new_AnsprechpersonId",
"new_Besuchsdatumvon",
"new_Besuchsdatumbis",
"new_Teilnehmer",
"new_Beschreibung"
], null);
var thema = bericht.new_name;
var owner = bericht.OwnerId;
var ortDesBesuchs = bericht.new_OrtdesBesuchs;
var ansprechperson = bericht.new_AnsprechpersonId;
var besuchsdatumvon = bericht.new_Besuchsdatumvon;
var besuchsdatumbis = bericht.new_Besuchsdatumbis;
var teilnehmer = bericht.new_Teilnehmer;
var beschreibung = bericht.new_Beschreibung;
var ansprechName = "";
if (ansprechperson.Name != null)
ansprechName = ansprechperson.Name;
var dateVon = new Date(parseInt(besuchsdatumvon.replace("/Date(", "").replace(")/", ""), 10)).toLocaleString();
var dateBis = new Date(parseInt(besuchsdatumbis.replace("/Date(", "").replace(")/", ""), 10)).toLocaleString();
var mailText = "<div style=\"font-family: Arial; font-size: 11pt;\">";
mailText += "Thema: " + thema;
mailText += "<br/><br/>";
mailText += "Ort des Besuchs: " + ortDesBesuchs;
mailText += "<br/><br/>";
mailText += "Ansprechperson: " + ansprechName;
mailText += "<br/><br/>";
mailText += "Besuchsdatum von: " + dateVon;
mailText += "<br/>";
mailText += "Besuchsdatum bis: " + dateBis;
mailText += "<br/><br/>";
mailText += "Teilnehmer: " + teilnehmer;
mailText += "<br/><br/>";
mailText += "Beschreibung: <br/>";
mailText += beschreibung;
mailText += "</div>";
Xrm.Page.getAttribute("subject").setValue(thema);
var mailDescription = Xrm.Page.getAttribute("description");
if (mailDescription != null)
mailDescription.setValue(mailText.toString());
alert("description set");
The Subject is set every time and the "alert" in the end is fired after every load of the page.

Similar Messages

  • FM required for setting the message body with values from table

    Hi all,
      I have a retq wherein in tcode VL31n when i create the IBD,after saving the document,i need to send a mail to few people in the FI dept with the foll deatils:
    Inbound delivery no.
    A. Bill of Lading no.
    B. Bill of Lading date
    C. No. of containers
    D. Invoice no.
    E. Invoice date
    F. Supplier name
    G. Vessel name
    H. Name of the receiving port
    I. Final Destination,,
    J. Expected date of arrival
      The method used is SAVE_AND_PUBLISH_DOCUMENT.i get all these deatils in the table it_xlikp.But is there  any FM by means of which i cna read these  values and set the message body with these values and send this  as  a mail using the FM SO_DOCUMENT_SEND_API1?Full points will be  awarded..Any help is appreciated..
    Regards,
    Disha.

    HI Disha
    Check out these links. They will surely help
    http://www.geocities.com/mpioud/Z_EMAIL_ABAP_REPORT.html
    http://www.thespot4sap.com/Articles/SAP_Mail_SO_Object_Send.asp
    If you find this answer useful, please reward me for the same.
    Good luck
    Karthik Potharaju

  • Dynamically set y axis (position) with javascript

    Hello
    I wonder if it is possible with javascript to set a y position of flowed subform in non interactive adobe form?
    For example: For a certain subform  which is inclued in (flowed) main I want to be shown at certain vertical (y) position but only in the last page at bottom of main.
    Last page I can find with
    if(xfa.layout.page(this) == xfa.layout.pageCount())
    but when changing
    this.y = "100 mm"
    it doesn't changes subform position.
    I also tried with this.y = "100in", but result is the same.
    Does anybody now a solution?

    It's not a field, it's a complete subform with a table and some texts fields, which I want to show only in last page.
    I tried changing subform to a positioned already before and changing it's y axis in javascript (tried in all events) doesn't work.
    Could it be that syntax posted in first post isn't correct?
    In that case (positioned subform) I have blank space on all pages but last one. For example, if a complete layout of a page is 100%, main 70% and subform 30%, I get 30% of blank space on all pages before last one, which I would like to avoid, so that main would be 100% in every page but last one and in the last one main should be only 70% and subform 30%.

  • When setting email attachments body is also attachment

    When an email attachment is included with an email, the body is also included as an attachment.
    Isn't it possible to show the body content normally within the email instead of making it a seperate attachment?

    This is being fixed. Please work through support if you need the patch

  • Set values in ListBox with Javascript.

    Hello.
    I have a ListBox that can have multiple values (you can set this in Designer 7.1 by the way). I want to select 1, 2, x, values in this ListBox by script in Javascript. I can read these values like this:
    var a = xfa.resolveNode ("ListBox1.value").nodes;
    xfa.host.messageBox (a.item(0).value);
    But how can I set the values?
    Another question: Is it possible to get these values as an array or do I have to parse the value above to get the values?
    /Per

    DropDownList2.clearItems(); <br />DropDownList2.rawValue =""; <br />//Add the new ones with an indexed boundItem <br />var myIndex = this.boundItem(xfa.event.change); <br />var cities = new Array( <br />  new Array("New Orleans", "NYC", "L.A."), <br />  new Array("Paris", "Lyon", "Marcheilles"), <br />  new Array("London", "Liverpool", "Newcastle", "Manchester"), <br />  new Array("Tokyo", "Kyoto", "Hiroshima"), <br />  new Array("Bremen", "Hannover", "Hamburg", "Berlin")); <br />for (i=0;i<cities[myIndex].length;i++){ DropDownList2.addItem(cities[myIndex][i] , String(i)); } <br />/Ulf DTP-tjänst

  • Setting own security handler with JavaScript

    Hi,
    I build the security handler plugin example (SecurityHandler.api) and installed it. Then I wanted to set this handler via JavaScript to a document but I have no access to it. If I list all handlers (security.handlers) in a trusted function only the standard handler occur. If I change the security settings via Adobe I have the handler listed in the drop down box. I am using Acrobat 8 Professional.
    Many thanks for your advice in advance!
    Regards
    Jörg

    Ian,
    As a general statement, wireless networks are inherently insecure.
    "I have now switched off the broadcasting of the name.
    What level of security is this?
    If this is all you have done, roughly speaking, your network is just as
    (in)secure as it was when you plugged in the router.
    Do you have file or printer sharing turned on? Are your Mac firewalls
    stealthed and refusing UDP packets? Will the router accept any inbound
    request for an internet connection? Have you changed the default password
    on the router?
    The answers to these questions speak to the relative (in)security of your
    Macs.
    Is your son using any form of encryption, say, WEP, or, preferably, WPA?
    If not, your network is less secure.
    "We live in a quiet cul-de-sac where any strange people or cars would be noticed immediately, so we are probably not so vulnerable to wireless-hackers as others might be. Or am I living in a "fool's paradise"?"
    Yes, and here's why.
    "Does anyone know where I might be able to get hold of some reasonably simple, step by step instructions."
    I was going to suggest reading the router's manual, but it is pure and utter
    fertilizer. Looks as though a marketroid (who knows some buzzwords but
    not their meanings) patched that monstrosity together using the user
    menu storyboard walk-through and a lot buzzword-laden filler "lifted"
    from the Web.
    Would it be humanly possible to run an ethernet cable from your router to
    where your son computes and turn off the wireless?
    Since I don't own one, I can't help with a primer on securing it. Sorry.
    -Wayne

  • How to set email id associated with our profile

    Hi,
    I've recently started working for a client and initially when the client id got created for me, they did not create client email id for me. And hence when my name is selected in the people/group column, for send a workflow email, it was sent to the person
    from the client company who created my profile.
    I recently raised a ticket to get my email id and i got one now. But still when an email is sent to me, it goes to that person. 
    How to integrate the email id for my sharepoint profile name. ?
    Many thanks for your help !
    Regards

    Hi,
    Based on you description, my understanding is that you want to update your emailID in SharePoint.
    If your environment is in Office 365 you need to update your email id in your SharePoint user profile
    If your environment is on-premises update your AD then run UserProfile synchronization in SharePoint from central admin.
    Thanks, Shakir | Please 'propose as answer' if it helped you, also 'vote helpful' if you like this reply.

  • How to Control the Favorites  T-code Description changed with the Logon La

    Dear All,
             I have a issue for this: user want to set Favorites Description changed with the Logon langue, For example: In EN Langue, The MM01 in Favorites is u2018Material createu2019, If user used the other Langue, he want the u2018Material createu2019 changed the logon langue.
    If the t-code in SAP menu, the description can change with logon langue?
    How to set?
    Please help me!
    Thanks
    Sun
    Edited by: sun on Dec 19, 2008 2:23 AM

    hi,
    pls check this link
    http://searchsap.techtarget.com/tip/0,289483,sid21_gci862499,00.html
    use these FM
    STREE_USER_FAVORITES_COPY
    STREE_FAVORITES_MAINTAIN
    thanks

  • How to set Email Body in srw.add_parameter(myPlist,'MESSAGE'....

    Hi, i have created following procedure to send email using event driven Publishing API,
    it works fine, i have using "message" and "body" in add_parameter ,but it send email with no body/message,blank email body.
    Please help out how to set email body....
    im using
    - AS 10g(10.1.2)
    - Windows Server 2003
    --procedure
    CREATE OR REPLACE PROCEDURE testemail
    is
    myPlist SRW_PARAMLIST;
    myIdent SRW.Job_Ident;
    myStatus SRW.Status_Record;
    BEGIN
    --srw.start_debugging;
    myPlist := SRW_PARAMLIST(SRW_PARAMETER('',''));
    srw.add_parameter(myPlist,'GATEWAY','http://myserver:7778/reports/rwservlet');
    srw.add_parameter(myPlist,'SERVER','myrepserver');
    srw.add_parameter(myPlist,'REPORT','D:\Reports\abc.rdf');
    srw.add_parameter(myPlist,'USERID','abc/xyz@mydb');
    srw.add_parameter(myPlist,'DESTYPE','mail');
    srw.add_parameter(myPlist,'DESFORMAT','PDF');
    srw.add_parameter(myPlist,'DESNAME','[email protected]');
    srw.add_parameter(myPlist,'SUBJECT','Test Mail');
    srw.add_parameter(myPlist,'MESSAGE','This is test email');
    srw.add_parameter(myPlist,'FROM','[email protected]');
    myIdent := srw.run_report(myPlist);
    myStatus := srw.report_status(myIdent);
    --srw.stop_debugging;
    end;
    /

    1. Current work flow :-In web site the user have to register themselves in the web site and enters his details along with user id, password and email id. Once user
    is registered then he will login with his user id and password. The user id is picked from login control and that set in “SPWeb.CurrentUser” as user id and system uses "Membership.ValidateUser" method to Authenticate user for login. 
    2. New Requirement: we would like to facilitate the user to login with Email id as well as user id. 
    Problem: 
    We replaced "Membership.ValidateUser" method to our own method to Authenticate user with email id/user id and password. 
    When user is login with user id and password it is working successfully but in the case of email id and password –“the email id is picked from user control and set as
    "HttpContext.Current.User.Identity.Name" but we are not getting “SPWeb.CurrentUser” and it shows null value.” 
    We are able to get user id from database using email id of user. Please help us how we can set user id in "SPContext.Current.Web.CurrentUser".
    Mohan Prakash

  • Im trying to send out a word doc and it tells me I need to set up an account with enterage. I already have my email set up with regular mail? How can I send it out through my email that is active?

    Im trying to send out a word document via email. It tells me it cannot send because I have not yet set up an account with enterage. My email is active already with Apple regular mail program. How can I send it out through reg mail?

    Save the Word document. Create your email in your normal mail application (Mail?), click on the add attachment icon (the paperclip if you are using Mail). Navigate to where you saved the Word file and select it. It should now appear as an attachment in your email. If you are sending it to a PC user and you are using Mail make sure 'Send Windows-friendly attachments' is selected in the edit menu. And if you don't want the attachment to display inline within the body of the email Control+Click on it and select 'view as icon'.

  • Sending email in BizTalk with specific format body

    Hi,
    I need to construct the email body with the values coming in the incoming message.
    Below is the sample mail format which I need to send.
    Requirement is just to receive xml file and send mail based on the values present in the incoming message.
    Can anyone please help to achieve this in pipeline component.
    Is orchestration is necessary to achieve. Please help.
    Mail format:
    Subject: Alert Notification message (from message)
    Body:
    ============================================================
    Alert Notification
    Ename:               Ramesh
    ID:                     56958521225
    Destination:         GRE
    Source:               TRV
    City:                   AMERSFOORT
    Pcode:                Utvtg45
    Severity:             CRITICAL
    Address:              Test city
    Description:          Description
    Thanks in advance.

    You can achieve your requirement with both messaging-only or using Orchestration. For your requirement, I would create a HTML based email as the output you have shown requires
    some formatting.
    Messaging-only way:
    Create an XSLT which can output the HTML format as you have shown.
    Transform the XML (which you process in BizTalk) to HTML based.
     I have come up a draft version XSLT to your output format. I am using some dummy XPATH(This is a pseudo code, I have not tested it. Intention is just to give you some idea)
    <?xml version="1.0" encoding="utf-8"?>
    <xsl:stylesheet version="1.0"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:ns0="http://biztalk.orderapp.schemas.EmailResponse">
    <xsl:template match="/">
    <html>
    <body>
    <div>
    Alert Notification<br />
    <TABLE BORDER="0" cellspacing="2" cellpadding="2" width="90%">
    <xsl:apply-templates select="/ns0:EmailResponse"/>
    </TABLE>
    </body>
    </html>
    </xsl:template>
    <xsl:template match="/ns0:EmailResponse">
    <tr>
    <td class="style2">
    Ename:</td>
    <td>
    <xsl:value-of select="ns0:Header/ns0:Ename/text()"/></td>
    </tr>
    <tr>
    <td class="style2">
    ID:</td>
    <td>
    <xsl:value-of select="ns0:Header/ns0:ID/text()"/></td>
    </tr>
    <tr>
    <td class="style2">
    Destination:</td>
    <td>
    <xsl:value-of select="ns0:Header/ns0:Destination/text()"/></td>
    </tr>
    <tr>
    <td class="style2">
    Soruce:</td>
    <td>
    <xsl:value-of select="ns0:Header/ns0:Soruce/text()"/></td>
    </tr>
    <tr>
    <td class="style2">
    City:</td>
    <td>
    <xsl:value-of select="ns0:Header/ns0:City/text()"/></td>
    </tr>
    <tr>
    <td class="style2">
    PCode:</td>
    <td>
    <xsl:value-of select="ns0:Header/ns0:PCode/text()"/></td>
    </tr>
    <tr>
    <td class="style2">
    Severity:</td>
    <td>
    <xsl:value-of select="ns0:Header/ns0:Severity/text()"/></td>
    </tr>
    <tr>
    <td class="style2">
    Address:</td>
    <td>
    <xsl:value-of select="ns0:Header/ns0:Address/text()"/></td>
    </tr>
    <tr>
    <td class="style2">
    Description:</td>
    <td>
    <xsl:value-of select="ns0:Header/ns0:Description/text()"/></td>
    </TR>
    </xsl:template>
    </xsl:stylesheet>
    Pass this XSLT as the parameter to the custom pipeline (with XSLT transform component) to apply this XSLT to the XML received. Use XSLT Transform Component (BizTalk Server
    Sample) which is part of BizTalk SDK sample.
    XSLT Transform Component (BizTalk Server Sample)
    Other way in messaging-only approach:
    http://blogs.msdn.com/b/nabeelp/archive/2008/09/11/sending-an-html-email-without-an-orchestration.aspx. Use this XSLT as draft for this approach.
    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:output omit-xml-declaration="yes" method="xml" standalone="yes" version="1.0" encoding="UTF-8" />
    <xsl:template match="/">
    <html>
    <head>
    <title>Email</title>
    </head>
    <body>
    <p>
    Alert Notification.
    </p>
    <table class="style1">
    <tr>
    <td class="style2">
    Ename:</td>
    <td>
    <xsl:value-of select="//EmailMessageOut/Ename" /></td>
    </tr>
    <tr>
    <td class="style2">
    ID:</td>
    <td>
    <xsl:value-of select="//EmailMessageOut/ID" /></td>
    </tr>
    <tr>
    <td class="style2">
    Destination:</td>
    <td>
    <xsl:value-of select="//EmailMessageOut/Destination" /></td>
    </tr>
    <tr>
    <td class="style2">
    Soruce:</td>
    <td>
    <xsl:value-of select="//EmailMessageOut/Soruce" /></td>
    </tr>
    <tr>
    <td class="style2">
    City:</td>
    <td>
    <xsl:value-of select="//EmailMessageOut/City" /></td>
    </tr>
    <tr>
    <td class="style2">
    PCode:</td>
    <td>
    <xsl:value-of select="//EmailMessageOut/City" /></td>
    </tr>
    <tr>
    <td class="style2">
    Severity:</td>
    <td>
    <xsl:value-of select="//EmailMessageOut/Severity" /></td>
    </tr>
    <tr>
    <td class="style2">
    Address:</td>
    <td>
    <xsl:value-of select="//EmailMessageOut/Address" /></td>
    </tr>
    <tr>
    <td class="style2">
    Description:</td>
    <td>
    <xsl:value-of select="//EmailMessageOut/Description" /></td>
    </tr>
    </table>
    </body>
    </html>
    </xsl:template>
    </xsl:stylesheet>
    Use SMTP adapter to email the output.
    Using Orchestration:
    Similar way, apply the XSLT in orchestration. I would use this if you use dynamic SMTP adapter (even you can use custom pipeline component for dynamic SMTP adapter without
    the need to Orchestration).
    Refer this article for help
    Sending an HTML-Formatted E-Mail Message from BizTalk
    If this answers your question please mark it accordingly. If this post is helpful, please vote as helpful by clicking the upward arrow mark next to my reply.

  • Im having problems with my Kids facetime accounts that seem to be because they are both using my itunes and there are conflicts with multiple email addresses? Is it possible to now set the kids up with their own accounts without losing their apps etc

    Hi All,
    I have my kids using iTunes via thier ipods etc through my own account and this hase been the case for some time?
    This has started to cause issues lately with imessaging and facetime, as there seems to be a limit on email addresses that can be associated with one account?
    I wonder if I would be best off setting the kids up with their own accounts, but want to be able to do this without them losing their existing apps, music etc?
    Is this possible, if so is there a simple process cos I can seem to find anything relating to this?
    many thanks, Jim

    Not going to happen the way you want it to.
    When you add a gift card balance to the Apple ID, it's available for the Apple ID.
    Probably best to create unique Apple ID's for each... this will also make things easier in the future as purchases are eternally tied to the Apple ID they were purchased with.

  • My iPad, Macbook and Apple TV are all set up with the same iCloud email address.  I bought the iPhone 6 and accidentally set the iCloud up with a different email.  My phone will not let me change the email address to be the same as my other devices,

    My iPad, Macbook and Apple TV are all set up with the same iCloud email address.  I bought the iPhone 6 and accidentally set the iCloud up with a different email.  My phone will not let me change the email address to be the same as my other devices, it tells me that email is already being used. How do I delete the iPhones iCloud account and reinstall it to match my other devices.

    Yes it will, just sign out, then sign back in with the correct address.
    Settings>iCloud>Sign Out.

  • HT5622 I have just received a new iphone 5s and need to set the Apple ID with my work email.  I used my work email on my personal iphone 4s to set up an icloud account and it will not let me use my work email as the Apple ID on my new iphone. What do I do

    I have just received a new iphone 5s and need to set the Apple ID with my work email.  I used my work email on my personal iphone 4s to set up an icloud account and it will not let me use this email as the Apple ID on my new iphone.  As it is a work phone I need to use this email address as my Apple ID.  How do I do this?

    when you open the app store scroll down to the bottom it will display the apple id currently in use, change it to your normal apple id email

  • Set up apple Id with invalid email so can't validate new account. How can I edit account  info when I can't sign in for anything? Thx

    Set up apple Id with invalid email so can't validate new account. How can I edit account  info when I can't sign in for anything? Thx

    Hi Franklin777,
    If you are having issues with your Apple ID, this article will get you started.
    Frequently asked questions about Apple ID
    The first step is to find and edit the Apple ID you created:
    Apple ID: Finding your Apple ID
    If you need to reset your security questions this article will help ... 
    The rescue email address is a different address than the one you use for your Apple ID. 
    Rescue email address and how to reset Apple ID security questions
    You can edit or delete your rescue email address at My Apple ID. To edit your rescue email address:
    Navigate to My Apple ID using your web browser.
    Click "Manage your account"
    When prompted, sign in using your Apple ID and password.
    Click Password & Security
    You'll be asked to answer 2 of your 3 security questions before you can make any modifications. If you are unable to remember your answers, you can choose to send an email to your rescue email to reset your security questions.
    Hope you get back on track soon!
    - Judy

Maybe you are looking for