Delimited Report and Email

hi,
I've a delimited report, which outputs into an ascii text file. When i open output file
in notepad it looks ok. But when i open it in excel it gives a blank row between two
data rows. Seems like it's appending a carriage return after each row. How can i get
away with this.
Same problem happens in another report, which i'm sending through e-mail. When i open
it in previewer it's fine but when i send it through e-mail it gives a blank row between two
data rows. I'm using MAPI to send the e-mail.
if possible please also reply at
[email protected]
thanks you
---himanshu

Hi,
One method I can suggest is to :
1. Spool the result to a file
2. Use the Unix shell to read the file [ The file will contain only 1 row, which is the result of your SQL ]
3. based on the value returned from SQL in the output spool file, you can decide on the next processing steps.
Here's a short example of SQL script and the Unix Shell :
----- Sql Script (a.sql) -----
Spool /usr/tmp/myfile;
select
count(1)
from from ud
where ud.country = 'CAN'
and ud.code NOT IN (select code from ud_update);
Spool off;
Exit;
-- The Shell Script ----
# call the SQL script
sqlplus userid/password@connectstring /usr/tmp/a.sql
res=`cat /usr/tmp/myfile.lst`;
if $res !=0 Then
run_another SQL script
elsif
echo "Return code is 0"
fi
-- Shailender Mehta --

Similar Messages

  • I have a spreadsheet file in apple's numbers that I use as a grade sheet.  I can generate an individual student's report and email a pdf version of this report to the student.  Is there anyway to automate this process to the entire spreadsheet?

    ?

    Hi Matt,
    Similar answer, as well. My first thought on reading the question was 'mail merge', as it was with Ed's question.
    But since you're already generating the individual reports using Numbers, 'printing' those to a PDF file and attaching the file to an email message would seem a better route to go.
    That should be doable using either Automator or AppleScript, but my expertise with either of those is about the same level as is was when I responded to Ed's question. I'll wish you luck, and leave this to the Automator or AppleScript experts.
    Regards,
    Barry
    PS: I'd suggest you prepare a copy of the document with the names (and perhaps the marks/grades) replaced with anonymous ones. I suspect a look at the actual file will be necessary to get a handle on its structure.
    B.
    Message was edited by: Barry (Added PS)

  • Scheduling of Discoverer Reports and emailing output to multiple recipients

    Hi,
    Is is possible using Oracle Discoverer Server (Plus and Viewer) version 10.1.2 to schedule workbooks and then have the output of the scheduled workbooks emailed to multiple email recipients at the time the scheduled report completes?
    Kind regards,
    Leigh.

    hi,
    Within the discoverer tool there is no functional sulotion to email scheduled reports.
    This issue came up several times in the past to this forum,
    the solution is to use a third party tool that once the scheuled run is completed the third party tool will collect the output file and mail it.
    the workaround is described in MOS [ID 373812.1] How to Schedule Reports to Run at a Specific Time and Automatically E-mail The Output
    Tamir

  • CC4.0 - Management report and email alerts

    Greetings-
    1. In Abap based CC4.0, Managemnet Report tab is not showing any result.
    2. Email alerts are not reaching out to monitors email id.
    CC cockpit's config for enabling these looks ok. Pls suggest wat are the steps(and how to) required outside cc cockpit in this regard.
    Would appreciate your quick response.

    2. Email alerts are not reaching out to monitors email id.
    Did you check with your basis guy on SMTP server configuration in ABAP client (tcode SCOT)?
    Thanks
    Himadama

  • File system usage report chart generation - automated via reports and email

    Hello,
    I have requirement where I have to generate a monthly file system usage chart (just like a tablespace total_mb, used_mb, free_mb....) and mail it directly to the client.....
    Any ideas or suggestions would be welcome....
    Thanks,
    S.

    It's a pretty open-ended question, because a number of things can be causing slow performance.  You mention needing to look at ODBC connection performance - I found that using ODBC drivers for iSeries was very slow in the past.  You might want to look at using the JDBC driver in the IBM JTOpen Toolkit - it made a big difference for us when we were querying iSeries in the past.
    When you refer to "reports" in this thread's title, do you mean reports from ColdFusion Report Builder?  Or to just ColdFusion .cfm pages?  How complex are these reports?  How much information is displayed, especially in tabular form?  Just rendering huge HTML tables (as in thousands of rows of data) will often cause browsers to become temporarily unresponsive or hang.  If you provide more details, we might better be able to target where the "pain point" really is.
    -Carl V.

  • How to run and email a report from SSIS

    Hi guys
    I need to set up an SSIS package that will run a standard report and email the results.
    I have sorted out the email side of the job, but need to know if/how I can run BPC reports from SSIS.
    Has anyone done anything similar, or have any tips/pointers?
    Thanks
    Craig

    Hi Craig,
    I have never done this, but I doubt this is something possible in a standard way, or if it's feasable, could be very difficult to set up.
    In fact, BPC works over Webservices, and it should probably be possible to use an ActiveX task inside our SSIS package and code something in VB there, referencing some API...
    In any case, why don't you use the Offline Distribution Wizard for that? It's doing exactly what you're expecting.
    Kind Regards,
    Patrick

  • Automate and email process report ??

    anyone know if there is a way to schedule (automate) the process monitor report and email it ??

    Hello,
    Both scripts are contained in the FDM Accellerators section in the workbench; and can be scheduled via the FDM TaskManager or 3rd party TaskManager via upsShell.exe
    Thank you,

  • 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.

  • Unable to schedule a report to email and print

    I have been working on a task to both print and email a report to recipients whose email addresses are obtained at runtime.  So far I am able to email the report as a PDF attachment, however, I am not able to get the report to print.  I have three thoughts as to why the report is not printing.
    1. The printer is in a subdomain under the domain where InfoView and the Enterprise server reside.
    2. It is not possible to schedule a report for both an SMTP and print destination simultaneously.
    3. The format is causing an issue in printing - the SDK API states "Printer is a report format specific destination and can only be used when the report object is a Crystal Report."
    I have looked at the scheduled report in InfoView and can see that the print settings I am passing are correctly set for the scheduled instance.  Does anyone know if there is a problem with trying to schedule printing and email at the same time, or if the report format must be .rpt?
    Below is my code. Thank you for your time.
    String query = "Select SI_ID, SI_NAME, SI_PROCESSINFO, SI_SCHEDULEINFO, SI_SCHEDULE_STATUS From CI_INFOOBJECTS Where SI_ID=" + reportId;
            IInfoObjects results = null;
            ISchedulingInfo schedulingInfo = null;
            try {       
               results = iStore.query(query);           
            } catch( SDKException sdke ){
               logger.error(sdke);
            if( !results.isEmpty() ){
                // get the actual report object from collection and set scheduling information
                IInfoObject report = (IInfoObject)results.get(0);
                schedulingInfo = report.getSchedulingInfo();
                schedulingInfo.setType(CeScheduleType.ONCE);
                schedulingInfo.setRightNow(true);
                schedulingInfo.setRetriesAllowed(3);           
                try {
                    Set<String> keys = destinations.keySet();
                    Iterator i = keys.iterator();
                    while( i.hasNext() ){
                        String dest = (String) i.next();
                        if(dest.equals(CrystalDestinations.EMAIL)){
                            // get the destination object and set it to SMTP plugin
                            List emailAddress = destinations.get(CrystalDestinations.EMAIL);
                            IDestination destinationObject = schedulingInfo.getDestination();
                            destinationObject.setName("CrystalEnterprise.SMTP");    
                            IDestinationPlugin smtpPlugin = (IDestinationPlugin) iStore.query("SELECT * FROM CI_SYSTEMOBJECTS WHERE SI_PARENTID = 29 AND SI_NAME='CrystalEnterprise.SMTP'").get(0);
                            ISMTPOptions smtpOptions = (ISMTPOptions) smtpPlugin.getScheduleOptions();
                            smtpOptions.setDomainName( emailDomain );
                            smtpOptions.setServerName( smtpHost );
                            smtpOptions.setSMTPUserName( smtpUser );
                            smtpOptions.setSMTPPassword( smtpPass );
                            smtpOptions.setSubject( "Email for report " + report.getTitle() );
                            smtpOptions.setMessage( "This is the message body" );
                            smtpOptions.setSenderAddress( smtpUser + "@cdrh.fda.gov" );
                            smtpOptions.setSMTPAuthenticationType( ISMTPOptions.CeSMTPAuthentication.LOGIN );
                            for(int j = 0; j < emailAddress.size(); j++ ){
                                smtpOptions.getToAddresses().add( emailAddress.get(j) );
                            destinationObject.setFromPlugin( smtpPlugin );                                                                               
    } else if ( dest.equals(CrystalDestinations.PRINT) ){
                            List printers = destinations.get( CrystalDestinations.PRINT );                   
                            IReportPrinterOptions printerOptions = ((IReport)report).getReportPrinterOptions();
                            printerOptions.setCopies(1);
                            printerOptions.setEnabled(false);
                            printerOptions.setPrinterName( (String)printers.get(0) );                   
                            printerOptions.setPageLayout(IReportPrinterOptions.CeReportLayout.USE_SPECIFIED_PRINTER_SETTING);
                    List reportPrompts = ((IReport)report).getReportParameters();
                    for(int j = 0; j < reportPrompts.size(); j++){
                        IReportParameter prompt = (IReportParameter) reportPrompts.get(j);                   
                        if(prompt.getParameterName().equals(mdrParamName)){
                          IReportParameterSingleValue v = prompt.getCurrentValues().addSingleValue();
                          v.setValue(reportParameters.get(mdrParamName));
                        } else if(prompt.getParameterName().equals(addressParamName)){
                            IReportParameterSingleValue v = prompt.getCurrentValues().addSingleValue();
                            v.setValue(reportParameters.get(addressParamName)); 
                    IReportFormatOptions format = ( (IReport) report).getReportFormatOptions();
                    format.setFormat(IReportFormatOptions.CeReportFormat.PDF);
                    iStore.schedule( results );

    Hi Jason,
    Based on your code, I could not tell if you were scheduling a Crystal Report or a WebI document.
    Regardless, what I would suggest is you try scheduling the report/document on InfoView.
    Once you schedule it on InfoView, you can retrieve the instance on Query Builder (or through code) and compare the properties that are being set through InfoView and the one you set through your code.
    This should indicate if you are missing some properies or have set some properties incorrectly.
    Hope this helps.
    Regards,
    Dan

  • Report in PDF format and email it to some clients, using  Database Trigger

    Hi
    Is it possible to run a report in PDF format ad email it to some clients after a specific event through Database Trigger. For example whenever a client makes an entry into order entry table (through entry form), a trigger should execute on Orders table, this trigger should execute or generate a PDF formatted report and finally mail it to Sales team?
    I have
    ORAS 10g(10.1.2.0.2)
    utl_mail configured.

    In Reportsconfig.properties file the http port is 7778,
    now the output is like this...
    SQL> /
    * WELCOME TO EVENT-BASED-REPORTING API *
    * API-Version : 9i *
    * (C) Oracle Corporation, 2000 - 2002 *
    * Debugging turned ON **************************
    *** Length of Paramlist : 1
    OK : Parameter added : GATEWAY=http://myserver.com:7778/reports/rwservlet
    *** Length of Paramlist : 2
    OK : Parameter added : SERVER=rep_myserver_oracleas2
    *** Length of Paramlist : 3
    OK : Parameter added : REPORT=D:\Reports\emp.rdf
    *** Length of Paramlist : 4
    OK : Parameter added : USERID=abc/xyz@mydb
    *** Length of Paramlist : 5
    OK : Parameter added : DESTYPE=mail
    *** Length of Paramlist : 6
    OK : Parameter added : DESFORMAT=PDF
    *** Length of Paramlist : 7
    OK : Parameter added : [email protected]
    Starting run_report: building url
    *** Building URL (RUN_REPORT)
    OK : URL built :
    http://myserver.com:7778/reports/rwservlet?SERVER=rep_myserver_oracleas2&REPO
    RT=D%3A%CReports%5Cemp.rdf&USERID=abc%2Fxyz%40mydb&DESTYPE=mail&D
    ESFORMAT=PDF&DESNAME=khan.emran84%40gmail.com&statusformat=xml
    *** Submitting HTTP Request
    *** using URL
    :http://myserver.com:7778/reports/rwservlet?SERVER=rep_myserver_oracleas2&REP
    ORT=D%3A%5CReports%5Cemp.rdf&USERID=abc%2Fxyz%40mydb&DESTYPE=mail&
    DESFORMAT=PDF&DESNAME=khan.emran84%40gmail.com&statusformat=xml
    OK : Request submitted - Return stream : <?xml version = '1.0' encoding =
    'ISO-8859-1' standalone = 'yes'?>
    <serverQueues>
    <error code="50159"
    component="REP" message="Executed successfully but there were some errors when
    distribute the output"/>
    <
    OK : Request submitted - Length of stream : 229
    *** XML-Parsed - Following Structure discovered :
    *** Checking elements!
    serverQueues ()
    *** Checking attributes!
    error
    *** Checking attributes!
    __code = 50159
    __component = REP
    __message = Executed successfully but there were some errors when distribute the
    output
    *** Finished Parsing XML
    Getting value for element: job
    Getting value for element: error
    *** Requesting value for Attribute error.component [REP]
    Getting value for element: error
    *** Requesting value for Attribute error.code [50159]
    Getting value for element: error
    *** Requesting value for Attribute error.message [Executed successfully but    
    there were some errors when distribute the output]
    REP-50159:Executed successfully but there were some errors when distribute the
    output
    declare
    ERROR at line 1:
    ORA-20999:
    ORA-06512: at "NRSP.SRW", line 264
    ORA-06512: at "NRSP.SRW", line 799
    ORA-06512: at line 15

  • PDF Report generation and email it from a DB trigger

    Dear all
    Is it possible to run a report in PDF format ad email it to some clients after a specific envent through Database Trigger. For example whenever a client makes an entry into order entry table (through entry form), a trigger should execute on Orders table, this trigger should execute or generate a PDF formatted report and finally mail it to Sales team?
    I'm using Oracle Database 10g. Rel.2 on Windows-XP.

    kamranpathan wrote:
    Is it possible to run a report in PDF format ad email it to some clients after a specific envent through Database Trigger. No. Not the way you imagine.
    A trigger is fired when? During the transaction. The transaction still is not committed and can be rolled back. So if you start doing notifications and what not in the trigger, and the transaction is rolled back, then that transaction never happened. But your notification code did. And the users have been informed incorrectly - about something that did not happen.
    The same trigger can also be fired in the same transaction for the same row - more than once. This can happen in specific circumstances in Oracle, where basically Oracle itself does an undo of the transaction (trigger already fired) and then redo that transaction (trigger fire again).
    So in such a case, your trigger will generate two notifications from the same trigger for the same event. Inside a transaction that still could be rolled back by the session owner.
    The correct approach is not to perform the action in the trigger. It is to queue the action to be executed when the transaction is committed.
    For example, the trigger is on the PRODUCTS table. When a new product is added, a notification needs to be send to customers that have selected to be informed of new product releases.
    The first step is to write a package that performs this notification. The procedure that drives the notification processing, gets a product identifier as input and does the checks and notification.
    After this package has been tested, it is implemented indirectly via a trigger on the PRODUCTS table. Instead of the trigger directly calling this package, the trigger needs to queue an action that will execute the notification package when the transaction is committed.
    This can be done using DBMS_JOB. In the trigger, a job is submitted to execute that notification package for the current product ID. The job submission is part of the existing transaction. If the transaction is rolled back, so is the job and it is removed from the job queue. If the transaction is committed, the job is also committed to the job queue and executed.

  • Report to file and email (excel or pdf)

    Hi!
    I have a report where I list financial data about a company. The report is only one pivot table! There is a dashboard prompt, where you can choose the company you want to see.
    I need to save the report in excel or pdf for ALL the listed companies. I need to email some of them.
    How can I do that? I looked around the Delivers and the Publisher, but I wasn't successful.
    Thanks
    Andras Szenci

    user10912001, if you still have no answer on your question...
    Placing a report and a prompt to a dashboard (as you described you have done it), you can clearly see a button in left-down field of a dashboard
    !http://lh6.ggpht.com/_7E85bAvCFxg/Sj8oKflJ8WI/AAAAAAAAAHE/gvH2bpnoJWY/2009-06-22_104330.png!
    where you have a .pdf and .html format to print.
    Once you choose "Edit dashboard" in the list after clicking the button "Page option" (up-right side in the dashboards) you then click on the "Properties" button of the report (you want to have an option "Download to Excel") and choose "Report Links..." (where you checked an option "Download". Here you are - you have a link (bottom ao your report) where you have option to get the output in Excel format.

  • Data missing in scheduled report via email as pdf and excel

    Hi,
    I scheduled a webi report to email as pdf and excel, I am getting the mail but on pdf and excel only I can see the report header, values are missing
    Regards
    Aflal

    how come?
    do you have any parameters in this report?
    can you tell exactly the steps u r following doing
    thanks
    Amr

  • Newbie issue: export a report and/or email

    The application in question is a patch management system. I would like to create a report with charts, basically design a special pages of statistics, that could be emailed out to a group of individuals on a daily or weekly basis, or, alternatively, have the page send to an external web site which auto-updates daily.
    The purpose of this is to provide an easy overview of critical information to upper management without them having to wade through all of the additional reports and information the whole application provides.
    Does anyone know of a fairly simple way to accomplish this?
    Thanks.

    polite bump

  • How to create an excel report and send it via email using a BPEL process ?

    Hi Experts,
    I have a requirement to develop a xl report based the data in the DB table. I will have to query the list of records entered / processed during previous day, generated the xl based report and send to users via email.
    I talked to one the experts, he asked me to use the following Adapter and BPEL activities to accomplish it.
                   DBAdapter --> {BPEL  process} --> Java Embedding --> Email Activity.
    Can someone please help me to pass the information retrieved by DBAdapter to Java Embedding and then to email import? I have created DBAdapter and Java Embedding. I don't know, how to retrieve the data read / sent by DBAdapter using Java Embedding. Also please help me to pass the xl attachment to Email Activity.
    Thanks for your help in advance!
    Thanks,
    Harisudhan Selvaraj

    I would suggest something like:
    DBAdapter --> Bpel Process --> File Adapter --> write file to location (you can write in csv which can be imported into xls)
    Read Location --> FileAdapter --> Bpel Process --> Email Activity
    Regards,
    Anshul

Maybe you are looking for

  • Foreign Currency Valuation - SAPF100 - Customers

    We are testing running CTA on customers and vendors. I have run it for the date of 7/31/2007 in August with the 'Reverse postings' clicked on. The vendor accounts posted the CTA entries and the reversing entries. The customer accounts posted only the

  • Why i cannot open my mozilla ?

    every i click my mozilla it's not work.

  • AS3 button to link to AS2 page

    I'm trying to figure out how to get the home button on an Action Script 3 page to the homepage, which is in Action Script 2. There is no AS3 on the homepage, and all of the content is different. Sooo, how do you do this? The .swf file is called homep

  • Color change when transferring image from Photoshop to After Effects

    Hi everyone, I am trying to import a logo from photoshop CS6 to After Effects CS6, however the black color within the image changes to a dark grey when it gets into AE. I noticed on the color picker in PS that it changes to the same grey color that i

  • Limiting the accessibility of a field ...

    A private field is inaccessible from anywhere outside the class and a protected field is accessible from anywhere in the same package. Is there a way of making a field accessible to just the class and its derivatives? That is, can I get the behaviour