CRM & VMS

Dear All;
     We are trying to integrate CRM with VMS, in SAP help it states that we need to connect VMS to CRM in order to be able to export data (VMS sales orders and Vehicles) into CRM. my question is, how to connect VMS to CRM???
i'd reaally appreciate it if anyone could help out.
thanx in advance,
Nahla

Hello Vipul,
It's great to know that.
Can you give me some details on how you solved the issue? I am facing a simialr issue at my site.
Regards,
abhishek

Similar Messages

  • Duplicate Check while creating new BP

    Dears,
    I am a CRM Consultant and working on a CRM VMS integration scenario, wherein BP(End customer) is created in VMS system and this will be replicated to SAP CRM system which has duplicate check active.  However we would like to perform the duplicate check within VMS System, so that it checks against existing BP records in BUT000 of VMS System.
    Can you share your experience in performing the same?
    Cheers
    Sweta

    Thanks Ritesh/Ganesh.
    Yes i understand that we can make certain fields which needs to be validated/checked during customer/bp creation process.
    Example:
    Customer 1 : Already exists in VMS DB.
    First Name: Steve
    Last name:  Jobs
    Mobile: 868686
    Email:[email protected]
    BP ID/Customer No : 100
    Customer 2: Being created by user in VMS DB
    First name: Steve
    Last name: jobs
    Mobile: 868686
    Email: [email protected]
    Based upon tolerance set by business, system will display a pop up with duplicate message....
    User can ignore the message and continue creating new customer/bp record or user can make use of BP/customer 100......
    This is how duplicate check works in the CRM System....
    Note: when system tries to find the potential duplicate , it is not actually checking in CRM DB, but in TREX.....
    So  can we achieve similar functionality in SAP VMS System ? if yes....can you please provide config steps or any BADI or user exit ..etc.....
    Hope i am clear...
    Thanks again for your suggestions.
    Best Regards
    Sweta

  • CVI in CRM 7.0 and ECC 6.0 IS-A VMS

    Hi experts
    I'm seeking for techinical advise on solution for CVI (Customer-Vendor Integration) in the given landscape.
    Refering to an excellent article from Mitchell Faiman (SAP) in CRM Expert and SAP help for CRM 6.0, we've done all the needfuls to set up but still has some issues.
    We're implementing a landscape with CRM 7.0, ECC 6.0 EhP4, NW EhP1, and IS-A-VMS (Vehicle Managmeent System). One of the key requirements is keeping BP master data clean and consistent across the landscape, including having the same ID, and having a mechanism to keep any changes reflected across the chain regardless of the change being made in CRM or ECC. In VMS, there is a requirement to have end-customer created as BP (role VLC001), as well as being a customer (KNA1) for SD Sales transaction and vendor (LFA1) for kickback payment in ECC. This is where we thought of CVI as the ideal solution. The ideal flow for us would be to have BP created in CRM (role CRM000), then via MW object BUPA_MAIN creates BP in ECC (hoping to find a way to default the role to VLC001 here as well, but that's another issue), and then with CVI, consequently creates a customer and vendor record, and extend ECC-BP with the FLCU00/FLCU01/FLVN00/FLVN01 in the process. (Flow diagram: CRM-BP -> ECC-BP -> ECC-KNA1 & ECC-LFA1)
    Once I've gone through the setup as mentioned in the article and SAP Help, I then proceeded to create BP in CRM only to find an error in the outbound queue in CRM reporting a syntax error in ECC program SAPLSFP_CRM. It turns out that there is a missing structure in ECC table which has not been activated (Actual error message is "The data object ES_FKKVKP does not have a component called ZAHKOND_SC" . We found out that this structure is related to FI-CAX (that explains the use of function module FSL_BUPA_MAIN_INBOUND instead of COM_BUPA_MAIN_INBOUND in Faiman's article). 
    The problem is, we simply cannot activate FI-CAX as that is considered another IS solution/business function, and according to SAP notes, only one IS solution can be activated per environment (we already have IS-A-VMS). That's a brick wall for us, and I wonder if there is anything we can do to overcome this.
    Obviously I have created an OSS note to SAP and has been in touch with the support consultant, who have advised on the restriction as mentioned, but no further solution is recommended just yet.
    A few questions here:
    1) Can you validate our understanding of the CVI concept and the flow?
    2) Will the slight change to the flow to rather create BP in ECC, then via CVI create KNA1 and LFA1, and consequently via MW object CUSTOMER_MAIN create BP in CRM work? If not, any solution to this at all?
    I would appreciate your valuable feedback and a proper solution that solves our issue will be awarded with points (as always).
    Thank you

    Just an update.
    SAP got back to me after a few dialogue to confirm that the function i was intending to use (CVI via FSL) is part of FI-CA, and is considered another IS function. However, since we already have IS-A installed (switched ON), it is not possible to activate such function in the same instance as the general rule from SAP is that no more than one IS is activated in one SAP instance.
    I did not quite understand this restriction though, and wondering how automotive company who sells cars as well as act as a financial leasing company would live within the SAP environment.
    We've resorted to enhancement solution (one-way activation), which is only half a solution we expect CVI & CRM MW should be able to offer.
    Thread closed.

  • VMS Integration with CRM System

    Dear All,
    I need help in the area of VMS Integration with CRM 5.0 system and the necessary settings for this.  Here VMS is going to be the Back-end system for CRM and the Data Flow between CRM and VMS vise versa.  We are using IC winclient as a channel for the pre and post sales processes.
    suggest me some documents and links in this regard.
    Thanks and regards,
    Ramana Rao

    Hi,
    Yes, You can create one system object with 3 different "Alias name" so one alias name used on one client ans so on...
    In user mapping  like
    alias name1=Client1
    alias name2=Client2
    alias name3=Client3
    Regards,
    Senthil K.
    [Points r welcome]

  • Two VMs inside Hyper-V Under 2012 Essentials R2? Need 2003 To Run as Well for CRM and SQL Server

    We are a small office (8 users) with a new server on the way.  We are running Server 2003 and CRM 4.0 and will upgrade to Server 2012 Essentials R2.  I would like to run this as a VM and integrate Azure's cloud backup.  The problem --and I'd
    like to be wrong about this -- is there is no included SQL server with Essentials 2012.  Our old server has SQL server 2005 which I believe was included.  Our database is only 1.6GB so we could use the free version of SQL Server 2014, but it is limited
    to one CPU.  Our new server is dual CPU, 8 total cores.  My thought is to use P2V and make a virtual machine from my current 2003 server, then run that inside the Hyper-V environment along with 2012 Essentials.
    So I have two questions?  Does the Essentials (or Hyper-V) licensing permit me to run any more VMs than the single instance of 2012 Essentials?  And secondly, will the primary 2012 Essentials installation acting as the Hyper-V administrator be
    able to use Azure to back up both virtual machines?
    If I am acting on any incorrect assumptions please correct me.

    I suggest that you follow your own suggestion on what to believe from posts.  Read the EULA on Essentials on your own.  And talk to a trained Microsoft licensing specialist.  Some of your assumptions are not valid.
    "I have purchased Server Essentials 2012 R2, which allows for one instance to implement the hypervisor and one instance of a virtual machine."
    From the data sheet describing Server Essentials is this statement - "
    With Windows Server 2012 R2 Essentials, the product licensing terms have been expanded to enable you to run one operating system instance on the physical server in order to run Hyper-V, plus a second instance on that server in order to run Essentials as
    a virtual machine.
    Therefore, the only VM you can legally run under Essentials is another copy of Essentials.
    "Furthermore it would be foolish for Microsoft to deny me additional virtual machines under that scenario since I can install Hyper-V Server 2012 R2 for free and use Essentials to manage it."
    FALSE.  Actually, virtualization rights are part of the Server operating system license.  Since the license is written by Microsoft, they can include whatever limits they deem appropriate.  In fact, when looking at Standard and Datacenter
    Editions of Windows Server, the ONLY difference between the two are the virtualization rights included with the operating system.  Your assumption that you can run it for 'free' under Hyper-V Server is incorrect.  True, Hyper-V server is
    a no-cost download from Microsoft, but it does not include any operating system licenses.  Those must be purchased separately.  Licenses are assigned to physical machines, not to virtual machines.  So it would be possible to use your 2003 license
    on a Hyper-V Server instance, but only if it is a non-OEM license.  OEM licenses are non-transferrable from the hardware with which they were sold.
    "It would also be foolish because I could virtualize everything under VMWare's ESXi --for free--"
    FALSE.  Same reason as given above.
    Lastly, be forewarned about P2V of a Windows Server 2003 machine.  If you spend any time reading this forum, you will find lots of horror stories about people having less than successful attempts at P2V'ing WS2003.  The recommendation is to build
    a 2003 VM from scratch to avoid the many pitfalls, assuming you do not have an OEM license.  Of course, even then you are still putting a business critical system on an operating system that is dropping support come July of next year, followed shortly
    thereafter by no support on SQL 2005.  Bottom line is that you would most likely be better served by trying to upgrade your application to a version that runs on the current release of Windows Server.
    . : | : . : | : . tim

  • DpVmCheck: max number of priv VMs exceeded (1 0, timeout)

    Hello,
    In our CRM system EHP1 FOR CRM 7 ABAP ,users get this screen mainly for big contracts at different stages like collision run,saving.
    Status before error started
    I have already gone through notes 1757252
    But the parameter rdisp/max_vm_priv_time and  rdisp/max_vm_priv_no doesn't exist in our system. Instead is there any other parameter which we can use in our release ?
    I could find these errors when the timeout screen occurred :
    DEV_DISP
    Wed Jul 23 15:26:08 2014
    DpVmCheck: max number of priv VMs exceeded (1 > 0, timeout), reset T59/M0/U13880/V4
    Wed Jul 23 15:26:28 2014
    DpVmCheck: max number of priv VMs exceeded (1 > 0, timeout), reset T59/M0/U13880/V4
    Wed Jul 23 15:26:46 2014
    *** ERROR => DpRqCheck: T59 in state TM_SLOT_FREE [dpxxdisp.c   8006]
    ***LOG Q0G=> DpRqBadHandle, bad_req ( DIA) [dpxxdisp.c   6125]
    *** ERROR => DpRqBadHandle: BAD REQUEST - Reason: DpRqCheck failed (line 7037): [dpxxdisp.c 6127]
    -IN-- sender_id DISPATCHER        tid 59    wp_ca_blk   -1 wp_id -1
    -IN-- action SEND_TO_WP        uid  13880 appc_ca_blk -1      type  DIA
    -IN-- new_stat  NO_CHANGE         mode 0     len 0       rq_id 24366
    -IN-- req_info DP_CANCEL_PRIV
    -IN-- msg_name  -
    *** ERROR => DpRqCheck: T59 in state TM_SLOT_FREE [dpxxdisp.c   8006]
    ***LOG Q0G=> DpRqBadHandle, bad_req ( DIA) [dpxxdisp.c   6125]
    *** ERROR => DpRqBadHandle: BAD REQUEST - Reason: DpRqCheck failed (line 7037): [dpxxdisp.c 6127]
    -IN-- sender_id DISPATCHER        tid 59    wp_ca_blk   -1 wp_id -1
    -IN-- action SEND_TO_WP        uid  13880 appc_ca_blk -1      type  DIA
    -IN-- new_stat  NO_CHANGE         mode 0     len 0       rq_id 24502
    -IN-- req_info DP_CANCEL_PRIV
    -IN-- msg_name  -
    *** ERROR => DpRqCheck: T59 in state TM_SLOT_FREE [dpxxdisp.c   8006]
    ***LOG Q0G=> DpRqBadHandle, bad_req ( DIA) [dpxxdisp.c   6125]
    *** ERROR => DpRqBadHandle: BAD REQUEST - Reason: DpRqCheck failed (line 7037): [dpxxdisp.c 6127]
    -IN-- sender_id DISPATCHER        tid 59    wp_ca_blk   -1 wp_id -1
    -IN-- action SEND_TO_WP        uid  13880 appc_ca_blk -1      type  DIA
    -IN-- new_stat NO_CHANGE         mode 0     len 0       rq_id 24691
    -IN-- req_info DP_CANCEL_PRIV
    -IN-- msg_name  -
    sm21:
    Q0  G Request (type DIA) cannot be processed
    work process trace
    please check the image
    Thanks
    Shradha

    Hello Divyanshu
    It didnt create dev_vm.trc and VM_STACK_TRACE
    And I am unable to provide dev_disp and dev_w* here due to size of the trace
    But could the error be due to any of these parameters :
    Parameters
    Current
    Changed
    rdisp/max_vm_priv_time
    2400
    SERVLET=2400, RFC=2400
    isp/max_vm_priv_no
    3
    SERVLET=3, RFC=3
    rdisp/max_priv_time
    600
    3600
    Maximum hold time for work processes in PRIV mode
    rdisp/max_debug_lazy_time
    600
    3600
    Maximum hold time for work processes in DEBUG mode
    rdisp/appc_ca_blk_no
    1000
    1058
    Buffer Size for CPI-C Communications
    rdisp/wp_ca_blk_no
    300
    1058
    Work Process Communication Blocks
    vmcj/option/ps
    960M
    1460M
    poolsize for the VMC
    vmcj/option/gc/sharedWaterMark
    90
    70
    VMC: watermark for shared garbage collector
    vmcj/max_vm_heap_MB
    64
    128
    max. vm heap
    rdisp/keepalive
    1200
    3600
    Timer for check of unused connections
    rdisp/keepalive_timeout
    60
    150
    Timeout for connection to SAPGUI
    rdisp/wppriv_max_no
    DEFAULT
    16
    Maximum number of work processes in PRIV mode

  • Manually Moving VMS from HOST to HOST *WITH* Shared SAS Storage

    Hi,
    Environment will be 2 Windows 2012 R2 Hyper-V servers.
    They will be connect via shared SAS.  These are two identical IBM servers with shared SAS storage
    I am hoping to eliminate using MS Clustering of the Hyper-V servers just to keep things straight forward.
    In the event, I had a complete failure of one of the  physical server Hyper V hosts, I was hoping be able to manually add/import (not sure what the terminology is here) and run the virtual machines on the second host until the first is repaired.
    If there is third party software that can do this, I would entertain it.
    In VMware (I had two hosts and would manually remove them from inventory on one server and add them to a second server). 
    Ideally, if I could keep both Hyper-V hosts in a Windows Workgroup and as vanilla as possible.
    Thanks in Advance,
    G

    Hi,
    Sorry for the late reply.  I have been researching all I can. And thanks to all for your patience and help!
    Let's start with the hardware to help paint the picture:
    2 @ IBM X3550 M4
    1 @ IBM V3700
    The two X3550's are going to be connected via 6GB SAS Cards (2/server for redundacy)
    Current environment (residing on VMWare with older IBM Xseries servers DS3524 connect via SAS connections)  40 users total.
    Windows servers are:
    1 @ SBS 2011 (One and only AD/PDC)
    2 @ Windows 2008 Servers that are CRM (these are Windows Member Servers)
    5 @ Windows 2003 servers that are going to be replace with Windows 2008 Servers (these are Windows Member servers) (low usage servers)
    Just to recap:
    The current environment running VMware 4.1 has both IBM X3500 servers able to see a  single 1.5 TB lun (SAS connected) presented by the DS3524.
    Currently, in VMware, I can see the same LUN on both servers.  I have all my VM's on HOSTA, if HOSTA should suffer a system board failure, I manually connect to HOSTB with the VMware client and add the VMs that I can see on the shared LUN
    and add them to HOSTB.
    My understanding is that its strongly recommend that my DC (not sure if they are implying PDC or BDC) on a physical server.  My hesitation is now I have to introduce a DC to SBS 2011 and manage a physical server and deal with with SBS 2011's quirks.
    So I was hoping that if I presented a LUN to both my HyperV hosts (In a Workgroup), and created on my VMs on hostA, if something went very bad with HOSTA,  I could connect to HOSTB and "Import" them and manually start the VMs, especially since
    SBS 2011 is sensitive.
    The client is okay with some downtime, so if the process is supported and works, then I am okay with doing the work.
    Clustering or even Replicas will add:
    Complexity to the environment
    Patching needs to be carefully planned as it would not look good to have to failover due to a Windows update on the primary host.
    The tech's that support that environment will now need to know about Clustering and/or Replication ontop of the SAN stuff
    I am looking at Veeam, Double-Take to see if they can work with 2 @ 2012 Hyper-V hosts configured in a Workgroup.
    The SBS 2011 is the "hinge" that will make or break the success of this project.  I personally love the way 2012 Hyper-V works, but it would be great if a physical server outside of the HyperV hosts was not required.
    Thanks !
    G

  • BADI for changing fields during Creation of BP in CRM

    Hello to everyone,
      I need to find a BADI (or other way) to default several fields during BP creation in CRM (4.0 SR1 SP9). The fields I will like to set are TAX TYPE, TAX NUMBER, TAX CATEGORY, etc.. I have found the BADI BUPA_TAX_UPDATE but i dont see any suitable parameters (structures) to changes these fields. Please advice and thanks in advance.

    Hi
    If you use function BUPA_NUMBERS_GET then your BP number will already be buffered and you can avoid a DB read. It may also be that the BP is not in the DB yet anyway.
    You can only pass one GUID in at a time - loop through IT_CHANGED_INSTANCES into a variable of type BU_PARTNER_GUID and pass that into the function as input parameter IV_PARTNER_GUID.
    Cheers
    Dom

  • Refresh CRM data in R/3 report

    Hi All,
    I've a report in R/3 where i get the Order Status of CRM through a RFC, but when i'm changing the status in CRM through crmd_order, when the report is open in R/3. When i press the refresh button, the status is not changed, it shows the previous status.
    Below is the code, can any1 help me how to go about
      CALL FUNCTION 'CRM0_READ_RFC_DEST'
        EXPORTING
         i_consumer             = 'CRM'
          i_download_type       = '*'
          i_objname             = '*'
      I_BAPICRMDH2          =
      I_REM_LOGSYS          =
        TABLES
          t_crmrfcpar           = t_crmrfcpar
    EXCEPTIONS
      NO_ENTRY_FOUND        = 1
      OTHERS                = 2
      IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
      IF NOT t_crmrfcpar[] IS  INITIAL.
        READ TABLE t_crmrfcpar INDEX 1.
        l_rfcdst = t_crmrfcpar-rfcdest.
      ENDIF.
    Call RFC
    *loop at z_guid into lguid.
    *endloop.
    *refresh ZORDER_STATUS.
    CALL FUNCTION 'ZCRM_HEADER_STATUS'
      DESTINATION l_rfcdst
    IMPORTING
          ORDER_IDRET       =   l_guid
      tables
          ORD_STATUS        = ZORDER_STATUS
    Regards
    Sanju

    any body?

  • Installation of IPC AP 7.0 Jar is getting Failed when uploading in CRM

    Hello Experts,
    we did some changes in the previosly uploded version of IPC AP 7.0  customer user exit Jar file in eclipse.
    While uploading the new modified jar through transaction /SAPCND/UE_DEV in CRM we are getting error :" installation of module <Jar file name > has failed ".
    when we checked the logs in SM 53 we seen the below mentioned error:
    Message: Exception of type com.sap.sql.log.OpenSQLException caught: Exception of type com.sap.sql.sqlparser.CommonSQLParserException: - statement "DELETE FROM "SVMCRT_MOD_TR_T" WHERE "MODULE_NAME" LIKE ? ESCAPE ^ (reason: Modification of ABAP tables is not permit ted)" is not supported
    caught: - statement "DELETE FROM "SVMCRT_MOD_TR_T" WHERE "MODULE_NAME" LIKE ? ESCAPE ^ (reason: Modification of ABAP tables is not permitted)" is not supported
    --> com.sap.sql.log.OpenSQLException: Exception of type com.sap.sql.sqlparser.CommonSQLParserException: - statement "DELETE FROM "SVMCRT_MOD_TR_T" WHERE "MODULE_NAME" LIKE ? ESCAPE '^' (reason: Modification of ABAP tables is n" is not suppor ted
    caught: - statement "DELETE FROM "SVMCRT_MOD_TR_T" WHERE "MODULE_NAME" LIKE ? ESCAPE '^' (reason: Modification of ABAP tables is not permitted)" is not supported
    at com.sap.sql.log.Syslog.createAndLogOpenSQLException(Ljava/lang/Class;Ljava/lang/String;[Ljava/lang/Object;)Lcom/sap/sql/log/OpenSQLException;(Syslog.java:85)
    at 
    if  required i can post the complete stack trace.
    any inputs/suggestions are most welcome.
    Thanks & regards,
    Siddharth

    Hi Mark,
    Yesterday after Posting the thread we found the same Note ,Issue occured because of  JAVA write access was not enabled on the table ,After enabling it as mentioned in SAP Note, Jar file get successfully uploaded.
    Thanks for your Help also.
    Regards,
    Siddharth

  • Custom message required on log on pop-up in SAP CRM WEB UI

    We required custom message to the log- on popup, right now the message is coming after we give the user ID and password "starting SAP CRM" instead of that
    user required welcome message.., how can achieve this ?
    Please reply as soon as possible.

    Hi Pankaj,
    did you already check the guide in the CRM Wiki:
    https://wiki.sdn.sap.com/wiki/display/CRM/WelcomeUserMessageinWeb+UI
    Hope this answers your question.
    Best Regards,
    Michael

  • New VMS/IPC boxes - speed and pricing

    For the most part, I've been a very happy FiOS customer. The internet side has gone out exactly once in the year I've had the service, and it was restored within an hour. TV has dropped out twice, both times very late at night (I assume for head-end maintenance). Reliability is better than every other ISP I've ever had, combined.
    That said..
    I wanted to snag another STB for the house - found out the local stores had all been closed (I can understand why from the financial aspect, but it was still a shock pulling up to my old store to pick up another STB.. and finding a "for lease" sign, when I'd been by there 2 months prior), so I looked at options online. The new VMS + IPC boxes looked promising, especially since they added the ability for the entire house to pause, rewind, schedule recordings, etc, from any TV - instead of only the DVR being able to do that (though the old boxes could stream recordings from the DVR).
    My chief complaint so far - while the VMS box itself is responsive, the IPC boxes are painfully slow to respond to anything. Picture quality is fantastic, but using them feels, to put it in nerd terms, like using a Pentium 90 with Windows XP and 128MB RAM. They take 5+ to respond to anything more than a channel change (and even that takes up to 3 seconds), and frequently "lose" remote key presses if you try to, say, hit guide, hit page down, then try to arrow down to the channel that you know is on the next page. It literally feels like a throwback to the earliest digital set top boxes from Comcast/Time Warner - the first ones with built-in TV listings in the mid 1990s. The speed is right on par with them; the only thing faster right now is they don't shut down for 30 minutes a day to update the TV listings.
    I've gone through the built-in diagnostics on the boxes to verify signal levels - they're decent (not perfect, but this is a 20 year old house with mostly original coax), but we have no pixelation or picture drop-out, so I would think they could carry the basic stuff between the IPC boxes and VMS pretty easily. The router certainly has no problem handling the 75/35 on the same coax (speedtest shows 85-90 down, 35-40 up, with a ~5ms ping, no matter which cable outlet it's plugged into)..
    My other complaint - why did Verizon move to "rooms" for pricing? I thought I was getting a DVR plus 3 STBs (since I ordered 3 STBs and asked for a DVR), instead of a VMS + 2 STBs - and I'm paying much more than I did for the old DVR + 2 STBs.
    With the griping out of the way - is there a reasonable chance that firmware updates will help with the speed of the IPC boxes? Or is there a chance it's a cabling issue? (I have no problem pulling new coax or cat5e, and I can provide signal levels if that'll help) If not, is there any chance of getting the old QIP7232 DVR + QIP7100 box back (and adding another 7100), and switching back to what I was paying before? I know they're a bit antiquated (especially the 7100s), but they were much more responsive, and didn't make me want to throw the STBs through the window. It just seems really rediculous that I'm paying such a large premium (plus the "upgrade fee") for equipment that, in terms of the user experience, is much worse.
    Again.. been a happy customer for a long time, but the new terminals are super painful to use.
    Thanks.

    If this is the case.  I think I will wait till the bugs are worked out
    Question what were you paying before and after for the boxes.   So what was the old DVR + 2 STB's and the new DVR plus 2 stb's
    Trying to get an idea of what you meant by way more.  Most people said same pricing and a small $20 or so upgrade fee

  • Dynamic CRM 2013 Online how to execute Report, generate PDF and email

    Dear All,
    I am using Dynamic CRM 2013 online. For quote, I have workflow and Dialogue processes for review process. On approval, I want the system to generate a PDF of quote report, attach the PDF and email it to the Customer.
    Better I would like, When approver, clicks on the approve button, the system should auto generate a PDF of quote report, attach the PDF and email it to the Customer, without any further input from the user. If its not possible, I may have to put button on
    quote form.
    I am using the attached code, but facing various issues.
    1. Under prepare the SOAP Message coding part, I am not sure what should be the below URL for CRM 2013 Online?
    xHReq.Open("POST", "/mscrmservices/2007/CrmService.asmx", false);
    2. What should be the emailid here? Is it Recepient Contact id(Guid) ?
    var emailid = resultXml.selectSingleNode("//CreateResult").nodeTypedValue;
    alert("emailid" + emailid.toString());
    3. Using this code, not able to create Entity for "ActivityMimeAttachment", I am getting newEntity as undefined.
    Below is the code I am using. Please check and help me out, where I am going wrong. Let me know if any better way to implement it. At present, I have put one button on quote form, on click event, below code will get executed.
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <title></title>
    <script type="text/javascript">
    var Xrm;
    if (window.opener) { Xrm = window.opener.Xrm; }
    else if (window.parent) { Xrm = window.parent.Xrm; }
    function getReportingSession() {
    var reportName = "Quotation_Report"; //set this to the report you are trying to download
    var reportId = "7C39D18F-1DC6-E311-8986-D89D6765B238"; //set this to the guid of the report you are trying to download
    var recordid = Xrm.Page.data.entity.getId();
    // recordid = recordid.substring(1, 37); //getting rid of curly brackets
    alert(recordid);
    var pth = Xrm.Page.context.getServerUrl() + "/CRMReports/rsviewer/reportviewer.aspx";
    var retrieveEntityReq = new XMLHttpRequest();
    retrieveEntityReq.open("POST", pth, false);
    retrieveEntityReq.setRequestHeader("Accept", "*/*");
    retrieveEntityReq.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
    retrieveEntityReq.send("id=%7B" + reportId + "%7D&uniquename=" + Xrm.Page.context.getOrgUniqueName() + "&iscustomreport=true&reportnameonsrs=&reportName=" + reportName + "&isScheduledReport=false");
    var x = retrieveEntityReq.responseText.indexOf("ReportSession=");
    var ret = new Array();
    ret[0] = retrieveEntityReq.responseText.substr(x + 14, retrieveEntityReq.responseText.indexOf("&", x) - x - 14); //the session id
    x = retrieveEntityReq.responseText.indexOf("ControlID=");
    ret[1] = retrieveEntityReq.responseText.substr(x + 10, retrieveEntityReq.responseText.indexOf("&", x) - x - 10); //the control id
    return ret;
    function createEntity(ent, entName, upd) {
    var jsonEntity = JSON.stringify(ent);
    var createEntityReq = new XMLHttpRequest();
    var ODataPath = Xrm.Page.context.getServerUrl() + "XRMServices/2011/OrganizationData.svc";
    createEntityReq.open("POST", ODataPath + "/" + entName + "Set" + upd, false);
    createEntityReq.setRequestHeader("Accept", "application/json");
    createEntityReq.setRequestHeader("Content-Type", "application/json; charset=utf-8");
    createEntityReq.send(jsonEntity);
    var newEntity = JSON.parse(createEntityReq.responseText).d;
    alert("new entity" + newEntity);
    return newEntity;
    function createAttachment() {
    var params = getReportingSession();
    var recordid = Xrm.Page.data.entity.getId();
    alert("recordid " + recordid);
    var orgName = Xrm.Page.context.getOrgUniqueName();
    var userID = Xrm.Page.context.getUserId();
    //create email record
    // Prepare the SOAP message.
    var xml = "<?xml version='1.0' encoding='utf-8'?>" +"<soap:Envelope xmlns:soap='http://schemas.xmlsoap.org/soap/envelope/'" +
    " xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'" +
    " xmlns:xsd='http://www.w3.org/2001/XMLSchema'>" +
    "<soap:Header>" +
    "</soap:Header>" +
    "<soap:Body>" +
    "<Create xmlns='http://schemas.microsoft.com/crm/2007/WebServices'>" +
    "<entity xsi:type='email'>" +
    "<regardingobjectid type='quote'>" + recordid + "</regardingobjectid>" +
    "<subject>" + "Email with Attachment4" + "</subject>" +
    "</entity>" +
    "</Create>" +
    "</soap:Body>" +
    "</soap:Envelope>";
    // Prepare the xmlHttpObject and send the request.
    var xHReq = new ActiveXObject("Msxml2.XMLHTTP");
    xHReq.Open("POST", "/mscrmservices/2007/CrmService.asmx", false);
    xHReq.setRequestHeader("SOAPAction", "http://schemas.microsoft.com/crm/2007/WebServices/Create");
    xHReq.setRequestHeader("Content-Type", "text/xml; charset=utf-8");
    xHReq.setRequestHeader("Content-Length", xml.length);
    xHReq.send(xml);
    // Capture the result
    var resultXml = xHReq.responseXML;
    // alert("resultXml " + resultXml);
    // Check for errors.
    var errorCount = resultXml.selectNodes('//error').length;
    if (errorCount != 0) {
    alert("ERROR");
    var msg = resultXml.selectSingleNode('//description').nodeTypedValue;
    alert(msg);
    var emailid = resultXml.selectSingleNode("//CreateResult").nodeTypedValue;
    alert("emailid" + emailid.toString());
    //var emailid = userID;
    var post = Object();
    post.Body = encodePdf(params);
    var email = new Array();
    email[0] =new Object();
    email[0].id = emailid;
    email[0].entityType ='email';
    post.Subject ="File Attachment";
    post.AttachmentNumber = 1;
    post.FileName ="Report.pdf";
    post.MimeType ="application/pdf";
    post.ObjectId = Object();
    post.ObjectId.LogicalName ="email";
    post.ObjectId.Id = email[0].id;
    post.ObjectTypeCode ="email";
    alert(post.ObjectId.Id);
    createEntity(post,"ActivityMimeAttachment", "");
    alert("created successfully");
    email.Subject = "Your Order";
    //Set The current order as the Regarding object
    email.RegardingObjectId = {
    Id: Xrm.Page.data.entity.getId(), //Get the current entity Id , here OrderId
    LogicalName: Xrm.Page.data.entity.getEntityName()//Get the current entity name, here it will be “salesOrder”
    //Create Email Activity
    SDK.JScriptRESTDataOperations.Create(email, "Email", EmailCallBack, function (error) { alert(error.message); });
    // Email Call Back function
    function EmailCallBack(result) {
    email = result; // Set the email to result to use it later in email attachment for retrieving activity Id
    var activityPartyFrom = new Object();
    // Set the From party of the ActivityParty to relate an entity with Email From field
    activityPartyFrom.PartyId = {
    Id: customerId, // id of entity you want to associate this activity with.
    LogicalName: "contact"
    // Set the "activity" of the ActivityParty
    activityPartyFrom.ActivityId = {
    Id: result.ActivityId,
    LogicalName: "email"
    // Now set the participation type that describes the role of the party on the activity).
    activityPartyFrom.ParticipationTypeMask = { Value: 2 }; // 2 means ToRecipients
    // Create the from ActivityParty for the email
    SDK.JScriptRESTDataOperations.Create(activityPartyFrom, "ActivityParty", ActivityPartyFromCallBack, function (error) { alert(error.message); });
    var activityPartyTo = new Object();
    // Set the From party of the ActivityParty to relate an entity with Email From field
    activityPartyTo.PartyId = {
    Id: ownerId, // id of entity you want to associate this activity with.
    LogicalName: "systemuser"
    // Set the "activity" of the ActivityParty
    activityPartyTo.ActivityId = {
    Id: result.ActivityId,
    LogicalName: "email"
    // Now set the participation type that describes the role of the party on the activity). activityPartyTo.ParticipationTypeMask = { Value: 1 }; // 1 means Sender
    // Create the from ActivityParty
    SDK.JScriptRESTDataOperations.Create(activityPartyTo, "ActivityParty", ActivityPartyToCallBack, function (error) { alert(error.message); });
    //ActivityParty From Callback
    function ActivityPartyFromCallBack(result) {
    //ActivityParty To Callback
    function ActivityPartyToCallBack(result) {
    var StringMaker = function () {
    this.parts = [];
    this.length = 0;
    this.append = function (s) {
    this.parts.push(s);
    this.length += s.length;
    this.prepend = function (s) {
    this.parts.unshift(s);
    this.length += s.length;
    this.toString = function () {
    return this.parts.join('');
    var keyStr = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
    function encode64(input) {
    var output = new StringMaker();
    var chr1, chr2, chr3;
    var enc1, enc2, enc3, enc4;
    var i = 0;
    while (i < input.length) {
    chr1 = input[i++];
    chr2 = input[i++];
    chr3 = input[i++];
    enc1 = chr1 >> 2;
    enc2 = ((chr1 & 3) << 4) | (chr2 >> 4);
    enc3 = ((chr2 & 15) << 2) | (chr3 >> 6);
    enc4 = chr3 & 63;
    if (isNaN(chr2)) {
    enc3 = enc4 = 64;
    else if (isNaN(chr3)) {
    enc4 = 64;
    output.append(keyStr.charAt(enc1) + keyStr.charAt(enc2) + keyStr.charAt(enc3) + keyStr.charAt(enc4));
    return output.toString();
    var bdy = new Array();
    var bdyLen = 0;
    function concat2Bdy(x) {
    bdy[bdyLen] = x;
    bdyLen++;
    function encodePdf(params) {
    bdy = new Array();
    bdyLen = 0;
    var retrieveEntityReq = new XMLHttpRequest();
    var pth = Xrm.Page.context.getServerUrl() + "/Reserved.ReportViewerWebControl.axd?ReportSession=" + params[0] + "&Culture=1033&CultureOverrides=True&UICulture=1033&UICultureOverrides=True&ReportStack=1&ControlID=" + params[1] + "&OpType=Export&FileName=Public&ContentDisposition=OnlyHtmlInline&Format=PDF";
    retrieveEntityReq.open("GET", pth, false);
    retrieveEntityReq.setRequestHeader("Accept", "*/*");
    retrieveEntityReq.send();
    BinaryToArray(retrieveEntityReq.responseBody);
    return encode64(bdy);
    </SCRIPT>
    <SCRIPT type=text/vbscript>
    Function BinaryToArray(Binary)
    Dim i
    ReDim byteArray(LenB(Binary))
    For i = 1 To LenB(Binary)
    byteArray(i-1) = AscB(MidB(Binary, i, 1))
    concat2Bdy(AscB(MidB(Binary, i, 1)))
    Next
    BinaryToArray = byteArray
    End Function
    </SCRIPT>
    </head>
    <body>
    <input type="button" onclick="createAttachment();" value="Attach Report" />
    </body>
    </html>
    Thanks. and waiting for your valuable comments.
    - Mittal

    Hello,
    Yes, I was able to make my code working as below. Tested on CRM online 2013.
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <title></title>
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.1/jquery.min.js"></script>
    <script type="text/javascript">
    if (typeof (SDK) == "undefined")
    { SDK = { __namespace: true }; }
    SDK.JScriptRESTDataOperations = {
    _context: function () {
    if (typeof GetGlobalContext != "undefined")
    { return GetGlobalContext(); }
    else {
    if (typeof Xrm != "undefined") {
    return Xrm.Page.context;
    else { return new Error("Context is not available."); }
    _getServerUrl: function () {
    var serverUrl = this._context().getServerUrl()
    if (serverUrl.match(/\/$/)) {
    serverUrl = serverUrl.substring(0, serverUrl.length - 1);
    return serverUrl;
    _ODataPath: function () {
    return this._getServerUrl() + "/XRMServices/2011/OrganizationData.svc/";
    _errorHandler: function (req) {
    return new Error("Error : " +
    req.status + ": " +
    req.statusText + ": " +
    JSON.parse(req.responseText).error.message.value);
    _dateReviver: function (key, value) {
    var a;
    if (typeof value === 'string') {
    a = /Date\(([-+]?\d+)\)/.exec(value);
    if (a) {
    return new Date(parseInt(value.replace("/Date(", "").replace(")/", ""), 10));
    return value;
    Create: function (object, type, successCallback, errorCallback) {
    var req = new XMLHttpRequest();
    req.open("POST", this._ODataPath() + type + "Set", true);
    req.setRequestHeader("Accept", "application/json");
    req.setRequestHeader("Content-Type", "application/json; charset=utf-8");
    req.onreadystatechange = function () {
    if (this.readyState == 4 /* complete */) {
    if (this.status == 201) {
    successCallback(JSON.parse(this.responseText, SDK.JScriptRESTDataOperations._dateReviver).d);
    else {
    errorCallback(SDK.JScriptRESTDataOperations._errorHandler(this));
    req.send(JSON.stringify(object));
    Retrieve: function (id, type, successCallback, errorCallback) {
    var req = new XMLHttpRequest();
    req.open("GET", this._ODataPath() + type + "Set(guid'" + id + "')", true);
    req.setRequestHeader("Accept", "application/json");
    req.setRequestHeader("Content-Type", "application/json; charset=utf-8");
    req.onreadystatechange = function () {
    if (this.readyState == 4 /* complete */) {
    if (this.status == 200) {
    successCallback(JSON.parse(this.responseText, SDK.JScriptRESTDataOperations._dateReviver).d);
    else {
    errorCallback(SDK.JScriptRESTDataOperations._errorHandler(this));
    req.send();
    Update: function (id, object, type, successCallback, errorCallback) {
    var req = new XMLHttpRequest();
    req.open("POST", this._ODataPath() + type + "Set(guid'" + id + "')", true);
    req.setRequestHeader("Accept", "application/json");
    req.setRequestHeader("Content-Type", "application/json; charset=utf-8");
    req.setRequestHeader("X-HTTP-Method", "MERGE");
    req.onreadystatechange = function () {
    if (this.readyState == 4 /* complete */) {
    if (this.status == 204 || this.status == 1223) {
    successCallback();
    else {
    errorCallback(SDK.JScriptRESTDataOperations._errorHandler(this));
    req.send(JSON.stringify(object));
    Delete: function (id, type, successCallback, errorCallback) {
    var req = new XMLHttpRequest();
    req.open("POST", this._ODataPath() + type + "Set(guid'" + id + "')", true);
    req.setRequestHeader("Accept", "application/json");
    req.setRequestHeader("Content-Type", "application/json; charset=utf-8");
    req.setRequestHeader("X-HTTP-Method", "DELETE");
    req.onreadystatechange = function () {
    if (this.readyState == 4 /* complete */) {
    if (this.status == 204 || this.status == 1223) {
    successCallback();
    else {
    errorCallback(SDK.JScriptRESTDataOperations._errorHandler(this));
    req.send();
    RetrieveMultiple: function (type, filter, successCallback, errorCallback) {
    if (filter != null) {
    filter = "?" + filter;
    else { filter = ""; }
    var req = new XMLHttpRequest();
    req.open("GET", this._ODataPath() + type + "Set" + filter, true);
    req.setRequestHeader("Accept", "application/json");
    req.setRequestHeader("Content-Type", "application/json; charset=utf-8");
    req.onreadystatechange = function () {
    if (this.readyState == 4 /* complete */) {
    if (this.status == 200) {
    successCallback(JSON.parse(this.responseText, SDK.JScriptRESTDataOperations._dateReviver).d.results);
    else {
    errorCallback(SDK.JScriptRESTDataOperations._errorHandler(this));
    req.send();
    __namespace: true
    </script>
    <script type="text/javascript">
    //Create Email and link it with Order as Regarding field
    var Xrm;
    var email = new Object();
    var ownerID = "";
    var CustomerId = "";
    if (window.opener) { Xrm = window.opener.Xrm; }
    else if (window.parent) { Xrm = window.parent.Xrm; }
    //Get ownerid who send email of quotation to customer
    function GetOwnerID() {
    var owner = Xrm.Page.getAttribute("ownerid").getValue();
    ownerID = owner[0].id;
    var ownerName = owner[0].name;
    var entityType = owner[0].entityType;
    GetToEmailGUID();
    //Get customerid who receive email of quotation from owner
    function GetToEmailGUID() {
    var Customer = Xrm.Page.getAttribute('customerid').getValue();
    CustomerId = Customer[0].id;
    var CustomerName = Customer[0].name;
    var entityType = Customer[0].entityType;
    //if CustomerId is type of "Account" then get Primary Contact id of that account
    if (entityType == "account") {
    var contact = Xrm.Page.getAttribute("customerid").getValue();
    if (contact === null) return;
    var serverUrl = Xrm.Page.context.getClientUrl();
    var oDataSelect = serverUrl + "/XRMServices/2011/OrganizationData.svc/AccountSet(guid'" + contact[0].id + "')?$select=PrimaryContactId";
    var req = new XMLHttpRequest();
    req.open("GET", oDataSelect, false);
    req.setRequestHeader("Accept", "application/json");
    req.setRequestHeader("Content-Type", "application/json;charset=utf-8");
    req.onreadystatechange = function () {
    if (req.readyState === 4) {
    if (req.status === 200) {
    var retrieved = JSON.parse(req.responseText).d;
    CustomerId = retrieved.PrimaryContactId.Id;
    else {
    alert(this.statusText);
    req.send();
    function CreateEmail() {
    GetOwnerID();
    email.Subject = "Email with Report Attachment";
    //Set The current order as the Regarding object
    email.RegardingObjectId = {
    Id: Xrm.Page.data.entity.getId(), //Get the current entity Id , here OrderId
    LogicalName: Xrm.Page.data.entity.getEntityName()//Get the current entity name, here it will be “salesOrder”
    //Create Email Activity
    SDK.JScriptRESTDataOperations.Create(email, "Email", EmailCallBack, function (error) { alert(error.message); });
    // Email Call Back function
    function EmailCallBack(result) {
    email = result; // Set the email to result to use it later in email attachment for retrieving activity Id
    var activityPartyFrom = new Object();
    // Set the From party of the ActivityParty to relate an entity with Email From field
    activityPartyFrom.PartyId = {
    Id: CustomerId, //"79EBDD26-FDBE-E311-8986-D89D6765B238", // id of entity you want to associate this activity with.
    LogicalName: "contact"
    // Set the "activity" of the ActivityParty
    activityPartyFrom.ActivityId = {
    Id: result.ActivityId,
    LogicalName: "email"
    // Now set the participation type that describes the role of the party on the activity).
    activityPartyFrom.ParticipationTypeMask = { Value: 2 }; // 2 means ToRecipients
    // Create the from ActivityParty for the email
    SDK.JScriptRESTDataOperations.Create(activityPartyFrom, "ActivityParty", ActivityPartyFromCallBack, function (error) { alert(error.message); });
    var activityPartyTo = new Object();
    // Set the From party of the ActivityParty to relate an entity with Email From field
    activityPartyTo.PartyId = {
    Id: ownerID, //"79EBDD26-FDBE-E311-8986-D89D6765B238", // id of entity you want to associate this activity with.
    LogicalName: "systemuser"
    // Set the "activity" of the ActivityParty
    activityPartyTo.ActivityId = {
    Id: result.ActivityId,
    LogicalName: "email"
    // Now set the participation type that describes the role of the party on the activity).
    activityPartyTo.ParticipationTypeMask = { Value: 1 }; // 1 means Sender
    // Create the from ActivityParty
    SDK.JScriptRESTDataOperations.Create(activityPartyTo, "ActivityParty", ActivityPartyToCallBack, function (error) { alert(error.message); });
    //ActivityParty From Callback
    function ActivityPartyFromCallBack(result) {
    //ActivityParty To Callback
    function ActivityPartyToCallBack(result) {
    GetReportId('Quotation');
    //Create attachment for the created email
    function CreateEmailAttachment() {
    //get reporting session and use the params to convert a report in PDF
    var params = getReportingSession();
    //Email attachment parameters
    var activitymimeattachment = Object();
    activitymimeattachment.ObjectId = Object();
    activitymimeattachment.ObjectId.LogicalName = "email";
    activitymimeattachment.ObjectId.Id = email.ActivityId;
    activitymimeattachment.ObjectTypeCode = "email",
    activitymimeattachment.Subject = "File Attachment";
    activitymimeattachment.Body = encodePdf(params);
    activitymimeattachment.FileName = "Report.pdf";
    activitymimeattachment.MimeType = "application/pdf";
    //Attachment call
    SDK.JScriptRESTDataOperations.Create(activitymimeattachment, "ActivityMimeAttachment", ActivityMimeAttachmentCallBack, function (error) { alert(error.message); });
    //ActivityMimeAttachment CallBack function
    function ActivityMimeAttachmentCallBack(result) {
    var features = "location=no,menubar=no,status=no,toolbar=no,resizable=yes";
    var width = "800px";
    var height = "600px";
    window.open(Xrm.Page.context.getServerUrl() + "main.aspx?etc=" + 4202 + "&pagetype=entityrecord&id=" + email.ActivityId, "_blank", features);
    // To open window which works in outlook and IE both
    //openStdWin(Xrm.Page.context.getServerUrl() + "main.aspx?etc=" + 4202 + "&pagetype=entityrecord&id=" + email.ActivityId, "_blank", width, height, features);
    //This method will get the reportId based on a report name that will be used in getReportingSession() function
    function GetReportId(reportName) {
    var oDataSetName = "ReportSet";
    var columns = "ReportId";
    var filter = "Name eq '" + reportName + "'";
    retrieveMultiple(oDataSetName, columns, filter, onSuccess);
    function retrieveMultiple(odataSetName, select, filter, successCallback) {
    var serverUrl = Xrm.Page.context.getServerUrl();
    var ODATA_ENDPOINT = "/XRMServices/2011/OrganizationData.svc";
    var odataUri = serverUrl + ODATA_ENDPOINT + "/" + odataSetName + "?";
    if (select) {
    odataUri += "$select=" + select + "&";
    if (filter) {
    odataUri += "$filter=" + filter;
    $.ajax({
    type: "GET",
    contentType: "application/json; charset=utf-8",
    datatype: "json",
    url: odataUri,
    beforeSend: function (XMLHttpRequest) {
    XMLHttpRequest.setRequestHeader("Accept", "application/json");
    success: function (data) {
    if (successCallback) {
    if (data && data.d && data.d.results) {
    successCallback(data.d.results);
    else if (data && data.d) {
    successCallback(data.d);
    else {
    successCallback(data);
    error: function (XmlHttpRequest, errorThrown) {
    if (XmlHttpRequest && XmlHttpRequest.responseText) {
    alert("Error while retrieval ; Error – " + XmlHttpRequest.responseText);
    function onSuccess(data) {
    reportId = data[0].ReportId.replace('{', ").replace('}', ");
    CreateEmailAttachment(); // Create Email Attachment
    //Gets the report contents
    function getReportingSession() {
    var pth = Xrm.Page.context.getServerUrl() + "/CRMReports/rsviewer/reportviewer.aspx";
    var retrieveEntityReq = new XMLHttpRequest();
    var Id = Xrm.Page.data.entity.getId();
    var quotationGUID = Id.replace('{', ""); //set this to selected quotation GUID
    quotationGUID = quotationGUID.replace('}', "");
    var reportName = "Quotation"; //set this to the report you are trying to download
    var reportID = "7C39D18F-1DC6-E311-8986-D89D6765B238"; //set this to the guid of the report you are trying to download
    var rptPathString = ""; //set this to the CRMF_Filtered parameter
    var strParameterXML = "<fetch version='1.0' output-format='xml-platform' mapping='logical' distinct='false'><entity name='quote'><all-attributes /><filter type='and'><condition attribute='quoteid' operator='eq' uitype='quote' value='" + quotationGUID + "' /> </filter></entity></fetch>";
    retrieveEntityReq.open("POST", pth, false);
    retrieveEntityReq.setRequestHeader("Accept", "*/*");
    retrieveEntityReq.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
    rptPathString = "id=%7B" + reportID + "%7D&uniquename=" + Xrm.Page.context.getOrgUniqueName() + "&iscustomreport=true&reportnameonsrs=&reportName=" +
    reportName + "&isScheduledReport=false&p:CRMAF_Filteredquote=" + strParameterXML;
    //remove the part starting from &p:salesorderid if your report has no parameters
    retrieveEntityReq.send(rptPathString);
    var x = retrieveEntityReq.responseText.indexOf("ReportSession=");
    var ret = new Array();
    ret[0] = retrieveEntityReq.responseText.substr(x + 14, retrieveEntityReq.responseText.indexOf("&", x) - x - 14); //the session id
    x = retrieveEntityReq.responseText.indexOf("ControlID=");
    ret[1] = retrieveEntityReq.responseText.substr(x + 10, retrieveEntityReq.responseText.indexOf("&", x) - x - 10); //the control id
    return ret;
    var bdy = new Array();
    var bdyLen = 0;
    function concat2Bdy(x) {
    bdy[bdyLen] = x;
    bdyLen++;
    function encodePdf(params) {
    bdy = new Array();
    bdyLen = 0;
    var retrieveEntityReq = new XMLHttpRequest();
    var pth = Xrm.Page.context.getServerUrl() + "/Reserved.ReportViewerWebControl.axd?ReportSession=" + params[0] +
    "&Culture=1033&CultureOverrides=True&UICulture=1033&UICultureOverrides=True&ReportStack=1&ControlID=" + params[1] +
    "&OpType=Export&FileName=Public&ContentDisposition=OnlyHtmlInline&Format=PDF";
    retrieveEntityReq.open("GET", pth, false);
    retrieveEntityReq.setRequestHeader("Accept", "*/*");
    retrieveEntityReq.send();
    BinaryToArray(retrieveEntityReq.responseBody);
    return encode64(bdy);
    var StringMaker = function () {
    this.parts = [];
    this.length = 0;
    this.append = function (s) {
    this.parts.push(s);
    this.length += s.length;
    this.prepend = function (s) {
    this.parts.unshift(s);
    this.length += s.length;
    this.toString = function () {
    return this.parts.join('');
    var keyStr = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
    function encode64(input) {
    var output = new StringMaker();
    var chr1, chr2, chr3;
    var enc1, enc2, enc3, enc4;
    var i = 0;
    while (i < input.length) {
    chr1 = input[i++];
    chr2 = input[i++];
    chr3 = input[i++];
    enc1 = chr1 >> 2;
    enc2 = ((chr1 & 3) << 4) | (chr2 >> 4);
    enc3 = ((chr2 & 15) << 2) | (chr3 >> 6);
    enc4 = chr3 & 63;
    if (isNaN(chr2)) {
    enc3 = enc4 = 64;
    } else if (isNaN(chr3)) {
    enc4 = 64;
    output.append(keyStr.charAt(enc1) + keyStr.charAt(enc2) + keyStr.charAt(enc3) + keyStr.charAt(enc4));
    return output.toString();
    </script>
    <script type="text/vbscript">
    Function BinaryToArray(Binary)
    Dim i
    ReDim byteArray(LenB(Binary))
    For i = 1 To LenB(Binary)
    byteArray(i-1) = AscB(MidB(Binary, i, 1))
    concat2Bdy(AscB(MidB(Binary, i, 1)))
    Next
    BinaryToArray = byteArray
    End Function
    </script>
    </head>
    <body>
    <input type="button" onclick="CreateEmail();" value="Attach Report" />
    </body>
    </html>
    Thank you,
    Mittal.

  • Follow up transaction in CRM

    Hi All,
    I want to create an Order in CRM with reference to the Standard Order (which is created in ECC and replicated from ECC to CRM).
    When I open the Transaction (which is created in ECC and replicated from ECC to CRM).
    in CRM and clikc on follow up I am not able to create the follow up transaction.
    The follow up transaction is in display mode.
    Can anybody give me inputs in this regard? where is wrong
    Will award the points for the helpful answer.
    Regards,
    -Rahul.

    Hi Shalini,
    The document is replicated from ECC to CRM without any errors.
    For this document I just want to create follow up transaction in CRM.(I dont want to change the document in CRM)
    The follow up transaction is in display mode. this is my problem.
    Hi Rekha:
    I have done following setting in CRM to create follow up transaction in CRM for the document which is replicated from ECC to CRM.
    1)     Defined the Copying Control for Transaction type
    2)     Defined Copying Control for Item categories
    3)     Defined Item category determination when copying
    Thanks in advance,
    Regards,
    -Rahul.

  • How to Delete the condition record in CRM

    HI,
    Can you please help me how to delete the condition record from condition table in CRM.
    Please explain the usage of FM CRMXIF_CONDITION_SEL_DELETE with examples.
    I have also read the documention of the function module. How to use this FM for custom defined condition table.
    (this is the code given in Documentation)
    DATA-OBJECT_REPRESENTATION         = 'E'
    DATA-SEL_OPT-CT_APPLICATION              = 'CRM'
    DATA-SEL_OPT-OBJECT_TASK                    = 'D'
    DATA-SEL_OPT-RANGE-FIELDNAME        = 'PRODUCT_ID'
    DATA-SEL_OPT-RANGE-R_SIGN                  = 'I'    (Including)
    DATA-SEL_OPT-RANGE-R_OPTION           = 'EQ'
    DATA-SEL_OPT-RANGE-R_VALUE_LOW  = 'PROD_1'
    Thanks
    Shankar

    Hi Shankar,
    I am using the same CRMXIF_CONDITION_SEL_DELETE function module to delete condition record present in CRM.
    But it is giving me below error in the return table of the FM after i run the program. Can you please correct me if I am doing any thing wrong?
    Error in  lt_return: SMW3     CND_MAST_SEL_DEL_EXT_VALIDATE     CND_M_SD
    code:
    ls_range-fieldname = 'PRODUCT_ID''.
    ls_range-R_SIGN = 'I'.
    ls_range-R_OPTION = 'EQ'.
    ls_range-R_VALUE_LOW = '123456'.
    APPEND ls_range TO lt_range.
    MOVE lt_range TO ls_entry-SEL_OPT-range.
    ls_data-SEL_OPT-object_task = 'D'.
    ls_data-SEL_OPT-ct_application = 'CRM'.
    ls_data-object_representation = 'E'.
    CALL FUNCTION 'CRMXIF_CONDITION_SEL_DELETE'
      EXPORTING
        DATA          = ls_date
    IMPORTING
       RETURN        = lt_return
    CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
      IMPORTING
        return = lt_ret.
    Edited by: Saravanaprasad Nadar on Jul 7, 2010 1:27 AM

Maybe you are looking for

  • Is there any way to fix the "Fatal Error" that my HP LaserJet CP1525nw color printer is having?cc=us

    I am getting a "Fatal Error" when I am trying to install my HP LaserJet CP 1525nw color printer on my new wireless network (using the CD). Anybody have an idea how to fix this?

  • Kernel error on startup after trying to backup with Time Machine

    Hi there, So last night I was using time machine to back up my macbook hard drive to my external hard drive. As this was happening, my machine was slowing down and such which I attributed it to having a couple of programs running at the same time as

  • Copy PR attachment to PO

    Hi Guru, I m creating automatic purchase order from purchase requisition. i m also attaching document to requisition. Can anybody tell me how to copy this attachment of requisition to purchase order. Regards, Dharmesh

  • Cannot install 32-bit Photoshop on 64-bit PC

    Hello, I am trying to install Photoshop CS6 on my Windows 8 64-bit PC. While in the loader option I chose both 64 and 32 bit installations, I only get 64-bit to install and work properly, and the Program Files (x86) protoshop cs6 folder stays empty.

  • Regarding table HRP1001

    Hi guys,           Need to know what is what in table hrp1001. 1) There are number of fields in this table but my interest is about OBJID and SOBID.   As far as my knowledge i assumed that this is a relationship table and defines relation between obj