• IanSampson
  • NEWBIE
  • 0 Points
  • Member since 2007

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 7
    Questions
  • 5
    Replies
Hi

I've created a Join report and need to open it from a custom object (a job) to see related information. You cannot pass parameters to a join report using a simple URL and passing pv0 and pv1 etc.

I've been inspired by the following two great articles:

http://salesforce.stackexchange.com/questions/8723/passing-variables-to-joined-reports
and 
http://www.tgerm.com/2011/04/passing-params-to-reports-salesforce.html

and generated
var url = "/00Ow0000006bRmf"; // report ID, in this instance New Contract Status
var method = "POST";
var idToUse = '{!Job__c.Id}'; // pulls in RecordID 


{ !REQUIRESCRIPT("/soap/ajax/29.0/connection.js") }
{ !REQUIRESCRIPT("/soap/ajax/29.0/apex.js") }

 
var postData = "op=run&runReportJson=%7B%22last_modified_user_id%22%3A%2200520000000joZX%22%2C%22breaks%22%3A%5B%7B%22brkcol%22%3A%22072w00000021Jd4%22%2C%22break%22%3A%22072w00000021Jd4%22%2C%22sortColumn%22%3A%22072w00000021Jd4%22%2C%22brkord%22%3A%22up%22%2C%22breakLevel%22%3A%220%22%2C%22brkdat%22%3A%220%22%7D%2C%7B%22brkcol%22%3A%22072w00000021Jc9%22%2C%22break%22%3A%22072w00000021Jc9%22%2C%22sortColumn%22%3A%22072w00000021Jc9%22%2C%22brkord%22%3A%22up%22%2C%22breakLevel%22%3A%221%22%2C%22brkdat%22%3A%220%22%7D%5D%2C%22colorRanges%22%3A%5B%5D%2C%22currency%22%3A%22GBP%22%2C%22cust_devName%22%3A%22Time_Job_Summary%22%2C%22id%22%3A%2200Ow0000006bRmf%22%2C%22cust_name%22%3A%22Time%3AJob+Summary%22%2C%22last_modified_by%22%3A%22Ian+Sampson%22%2C%22details%22%3A%22no%22%2C%22reportParams%22%3A%5B%7B%22param%22%3A%22block_id_counter%22%2C%22value%22%3A%224%22%7D%5D%2C%22templateKey%22%3A%22070w0000000LIsh%22%2C%22topn%22%3A0%2C%22c%22%3A%5B%5D%2C%22sortdir%22%3A%22down%22%2C%22sideBySide%22%3Afalse%2C%22blocks%22%3A%5B%7B%22templateKey%22%3A%22070w0000000LIsh%22%2C%22scope%22%3A%22organization%22%2C%22topn%22%3A0%2C%22c%22%3A%5B%22072w00000021JdR%22%2C%22072w00000021Jf3%22%2C%22072w00000021JfT%22%2C%22072w00000021JfU%22%2C%22072w00000021Jey%22%5D%2C%22last_modified_user_id%22%3A%22%22%2C%22breaks%22%3A%5B%5D%2C%22sideBySide%22%3Afalse%2C%22sortdir%22%3A%22up%22%2C%22colorRanges%22%3A%5B%5D%2C%22format%22%3A%22t%22%2C%22created_by_user_id%22%3A%2200520000000joZX%22%2C%22charts%22%3A%5B%7B%22ctsize%22%3A18%2C%22ctitle%22%3A%22%22%2C%22bgdir%22%3A%222%22%2C%22l%22%3A%221%22%2C%22bg2%22%3A16777215%2C%22csize%22%3A3%2C%22bg1%22%3A16777215%2C%22tfg%22%3A0%2C%22ct%22%3A%22none%22%2C%22sal%22%3Atrue%2C%22chco%22%3Atrue%2C%22chsp%22%3Afalse%2C%22cheh%22%3Afalse%2C%22cp%22%3A%22b%22%2C%22cfsize%22%3A12%2C%22fg%22%3A0%2C%22chst%22%3Afalse%2C%22summaries%22%3A%5B%5D%2C%22chsv%22%3Afalse%2C%22Yman%22%3Afalse%7D%5D%2C%22cust_name%22%3A%22Time+booked+to+cases.%22%2C%22v%22%3A142%2C%22co%22%3A%22yes%22%2C%22last_modified_date%22%3A%22%22%2C%22last_modified_by%22%3A%22%22%2C%22s%22%3A%5B%22072w00000021JfU%22%5D%2C%22details%22%3A%22no%22%2C%22blockId%22%3A%220%22%2C%22blkInfo%22%3A%7B%22blkjt%22%3A%22Job__c%22%2C%22blockId%22%3A%22B1%22%7D%2C%22customAggregates%22%3A%5B%5D%2C%22rt%22%3A%22070w0000000LIsh%22%2C%22filters%22%3A%5B%7B%22pc%22%3A%22072w00000021Jc7%22%2C%22pv%22%3A%22"&idToUse&"%22%2C%22pn%22%3A%22eq%22%2C%22pc2%22%3A%22%22%2C%22cc%22%3Afalse%7D%5D%2C%22reportParams%22%3A%5B%7B%22param%22%3A%22colDt_c%22%2C%22value%22%3A%22072w00000021JcQ%22%7D%2C%7B%22param%22%3A%22colDt_e%22%2C%22value%22%3A%22%22%7D%2C%7B%22param%22%3A%22colDt_q%22%2C%22value%22%3A%22custom%22%7D%2C%7B%22param%22%3A%22colDt_s%22%2C%22value%22%3A%22%22%7D%2C%7B%22param%22%3A%22function%22%2C%22value%22%3A%22c%22%7D%2C%7B%22param%22%3A%22name_op%22%2C%22value%22%3A%22co%22%7D%2C%7B%22param%22%3A%22save_drill%22%2C%22value%22%3A%22true%22%7D%5D%7D%2C%7B%22templateKey%22%3A%22070w0000000LIsm%22%2C%22scope%22%3A%22organization%22%2C%22sort%22%3A%22072w00000021JhW%22%2C%22topn%22%3A0%2C%22last_modified_user_id%22%3A%22%22%2C%22c%22%3A%5B%22072w00000021Jh5%22%2C%22072w00000021JhV%22%2C%22072w00000021JhW%22%2C%22072w00000021Jh0%22%5D%2C%22sideBySide%22%3Afalse%2C%22sortdir%22%3A%22up%22%2C%22breaks%22%3A%5B%5D%2C%22colorRanges%22%3A%5B%5D%2C%22format%22%3A%22t%22%2C%22created_by_user_id%22%3A%2200520000000joZX%22%2C%22cust_name%22%3A%22Time+booked+to+jobs%22%2C%22v%22%3A142%2C%22charts%22%3A%5B%7B%22ctsize%22%3A18%2C%22ctitle%22%3A%22%22%2C%22bgdir%22%3A%222%22%2C%22l%22%3A%221%22%2C%22bg2%22%3A16777215%2C%22csize%22%3A3%2C%22bg1%22%3A16777215%2C%22tfg%22%3A0%2C%22ct%22%3A%22none%22%2C%22sal%22%3Atrue%2C%22chco%22%3Atrue%2C%22chsp%22%3Afalse%2C%22cheh%22%3Afalse%2C%22cp%22%3A%22b%22%2C%22cfsize%22%3A12%2C%22fg%22%3A0%2C%22chst%22%3Afalse%2C%22summaries%22%3A%5B%5D%2C%22chsv%22%3Afalse%2C%22Yman%22%3Afalse%7D%5D%2C%22last_modified_date%22%3A%22%22%2C%22co%22%3A%22yes%22%2C%22last_modified_by%22%3A%22%22%2C%22details%22%3A%22no%22%2C%22s%22%3A%5B%22072w00000021JhW%22%5D%2C%22blockId%22%3A%221%22%2C%22blkInfo%22%3A%7B%22blkjt%22%3A%22Job__c%22%2C%22blockId%22%3A%22B0%22%2C%22csfReferences%22%3A%5B%22FORMULA1%22%2C%22FORMULA2%22%2C%22FORMULA3%22%5D%7D%2C%22customAggregates%22%3A%5B%5D%2C%22rt%22%3A%22070w0000000LIsm%22%2C%22filters%22%3A%5B%7B%22pc%22%3A%22072w00000021Jfb%22%2C%22pn%22%3A%22eq%22%2C%22pv%22%3A%22"&idToUse&"%22%7D%5D%2C%22reportParams%22%3A%5B%7B%22param%22%3A%22colDt_c%22%2C%22value%22%3A%22072w00000021Jfu%22%7D%2C%7B%22param%22%3A%22colDt_e%22%2C%22value%22%3A%22%22%7D%2C%7B%22param%22%3A%22colDt_q%22%2C%22value%22%3A%22custom%22%7D%2C%7B%22param%22%3A%22colDt_s%22%2C%22value%22%3A%22%22%7D%2C%7B%22param%22%3A%22function%22%2C%22value%22%3A%22c%22%7D%2C%7B%22param%22%3A%22name_op%22%2C%22value%22%3A%22co%22%7D%5D%7D%5D%2C%22format%22%3A%22mb%22%2C%22created_by_user_id%22%3A%2200520000000joZX%22%2C%22v%22%3A142%2C%22charts%22%3A%5B%7B%22ctsize%22%3A18%2C%22ctitle%22%3A%22%22%2C%22bgdir%22%3A%222%22%2C%22l%22%3A%221%22%2C%22bg2%22%3A16777215%2C%22csize%22%3A3%2C%22bg1%22%3A16777215%2C%22tfg%22%3A0%2C%22ct%22%3A%22none%22%2C%22sal%22%3Atrue%2C%22chco%22%3Atrue%2C%22chsp%22%3Afalse%2C%22cheh%22%3Afalse%2C%22cp%22%3A%22b%22%2C%22cfsize%22%3A12%2C%22fg%22%3A0%2C%22chst%22%3Afalse%2C%22summaries%22%3A%5B%5D%2C%22chsv%22%3Afalse%2C%22Yman%22%3Afalse%7D%5D%2C%22last_modified_date%22%3A%221%2F05%2F2015+5%3A33+PM%22%2C%22co%22%3A%22yes%22%2C%22blkInfo%22%3A%7B%22blkjt%22%3A%22Job__c%22%7D%2C%22customAggregates%22%3A%5B%7B%22IsCrossBlock%22%3Atrue%2C%22CalculatedFormula%22%3A%22B0%23Activity.Hours__c%3ASUM%2BB1%23Activity.Hours__c%3ASUM%22%2C%22DataType%22%3A%22N%22%2C%22IsActive%22%3Atrue%2C%22RowBreakContext%22%3A%22072w00000021Jc9%22%2C%22DeveloperName%22%3A%22FORMULA1%22%2C%22MasterLabel%22%3A%22Total+Hours%22%2C%22Scale%22%3A2%7D%2C%7B%22IsCrossBlock%22%3Atrue%2C%22CalculatedFormula%22%3A%22B0%23Job__c.Budget_hours__c%3AAVG%22%2C%22DataType%22%3A%22N%22%2C%22IsActive%22%3Atrue%2C%22RowBreakContext%22%3A%22072w00000021Jc9%22%2C%22DeveloperName%22%3A%22FORMULA2%22%2C%22MasterLabel%22%3A%22Budget%22%2C%22Scale%22%3A2%7D%2C%7B%22IsCrossBlock%22%3Atrue%2C%22CalculatedFormula%22%3A%22B0%23Job__c.Budget_hours__c%3ASUM-B1%23Activity.Hours__c%3ASUM-B0%23Activity.Hours__c%3ASUM%22%2C%22DataType%22%3A%22N%22%2C%22IsActive%22%3Atrue%2C%22RowBreakContext%22%3A%22072w00000021Jc9%22%2C%22DeveloperName%22%3A%22FORMULA3%22%2C%22MasterLabel%22%3A%22Remaining+Hours%22%2C%22Scale%22%3A2%7D%5D%2C%22rt%22%3A%22070w0000000LIsh%22%2C%22cust_owner%22%3A%2200lw0000002O9ru%22%7D";

    // You REALLY want async = true.
    // Otherwise, it'll block ALL execution waiting for server response.
    var async = true;

    var request = new XMLHttpRequest();

    // Before we send anything, we first have to say what we will do when the
    // server responds. This seems backwards (say how we'll respond before we send
    // the request? huh?), but that's how Javascript works.
    // This function attached to the XMLHttpRequest "onload" property specifies how
    // the HTTP response will be handled.
    request.onload = function() {

   //     var stateObj = { foo: "+ 00Ow0000006bRmf" };
   //     history.pushState(stateObj, "page 2", "+ 00Ow0000006bRmf");

        var status = request.status; // HTTP response status, e.g., 200 for "200 OK"
        var data = request.responseText; // Returned data, e.g., an HTML document.
        var x = window.open("", "_self", "", "false").document;
        x.open();
        x.write(data);
        x.close();

    } // END open window var

    request.open(method, url, async);


    request.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
    // Or... request.setRequestHeader("Content-Type", "text/plain;charset=UTF-8");
    // Or... whatever

    // Actually sends the request to the server.
    request.send(postData);
} // ONLOAD

But when I click the button on my Salesforce object I get  an error saying "Unexpected Token".

Any advice much appreciated.

Cheers
Ian

Does any one have the Regex to test for:

- ObjectIDs (15 and 18 digit length)

- case tracking IDs?

 

Thanks

Ian

We use Google Apps and the integration with Salesforce is fantastic.


When I email into Salesforce and don't assign an objectID, the email will appear under  the new "My Unresolved Items". This works perfectly.

However with Google Calendar Sync, surely my events added to Salesforce calendars through my Google calendar sync should appear in "the My Unresolved Events" tab - which is blank. (https://xxxx.my.salesforce.com/6AB?src=10). 

This is really important for us as this represents a very, very simple way for us (a professional services company) to record users time spent on activities.

If there is any work around, fix, trigger or script that we need to implement to make this happen, I would be very grateful.If there is any work around, fix, trigger or script that we need to implement to make this happen, I would be very grateful.

 

Cheers

Ian

Having waited for a long time for lookup filters to be implemented, I'm pretty disappointed to be told they are not available for lookups to contracts.

 

Anyone else know of a way around this or a reason?

Thanks

Ian

Please forgive this really simple example trigger which I'm struggling to get working.

 

I have a Contract record with a custom link to create a new Invoice object. Multiple contracts (children) can reference an Invoice. However when I create a new Invoice, I want the Contract field called "Invoice" to be updated with the InvoiceNumbe, I pass the contract number as a string to the Invoice.

 

 

I've written the trigger in Exclipse, it loads in SF and executes when the Invoice is Updated (I think). But the contract is not updated with the invoice number?

 

trigger trgContractInvoiceNum on Invoices__c (after update) { for (Invoices__c inv : Trigger.new) { Contract ctr = [Select c.Id, c.ContractNumber From Contract c where c.ContractNumber = :inv.SourceContract__c]; ctr.SalesInvoice__c = inv.Id; ctr.Billing_Log__c = inv.Id; / for test purposes } }

 

What silly mistake am I making?

 

Thanks

I'd really appreciate some help on the final steps of getting the email agent to work for me.

I have set up a VPS (virtual private server) with Westhost on an Apache sever. (I know nothing about Java and Unix BTW!)

I have installed the EmailAgent on the server and configured it correctly. If I log in using Putty (a SSH client), change to the EmailAgent directory in the root and then execute the command

java -jar /EmailAgent/Email2Case.jar /EmailAgent/sfdcConfig.txt /EmailAgent/log4j.properties

then everything works beautifully, it moves emails, drops attachments onto the server and every couple of minutes, check for new emails.

However as soon as I close the PUTTY session, the Java application stops and emails are not processed.

I have tried putting the above command into a Cron jab (and I know it's being executed) but the EmailAgent app does not run.

What am I doing wrong. Is there a better way of setting this up? Any assistance would be much appreciated.

Thanks
Ian
My knowledge of Java and Unix is very limited but I'm trying to get Email2Case running in a hosted environment, I have EmailAgent all installed and I can logon to the Apache server using Putty.exe (a SSH client) and execute the email2case.bat or "java -jar Email2Case.jar sfdcConfig.txt log4j.properties" provided I've changed directory to /EmailAgent. Everything runs fine and it checks our IMAP mail account every few minutes and moves new emails in SF fine - but as soon as I close Putty, it stops the process (I guess because because the user that executed the process has logged out).
 
I've to set up a cron job ( a unix scheduler apparently) but can't get it going. Here's what I have put into my crontab file:

*/5 * * * * /EmailAgent/email2case.bat   (i.e. run every 5 minutes).
 
What should I put in the crontab file?
 
I'm convinced I'm so close to getting a simple and cheap service setup to run email2case that many would be interested which I'd be happy to publish full details - if I could get it to work

Does any one have the Regex to test for:

- ObjectIDs (15 and 18 digit length)

- case tracking IDs?

 

Thanks

Ian

I had been trying to figure out how to get Chatter notifications when a new case comment is added to no avail until the following solution dawned on me. Feel free to use it, share it, etc.

"Case Comment Chatter-er"
  1. Create a field on your case page titled "Last Case Comment Date/Time" of type "Date/Time". Don't add it to your page layouts so it is basically hidden.
  2. Create workflow rule named something useful such as "Note Last Case Comment Date/Time"
  3. Object: Case Comment
  4. Evaluation Criterea: When a record is created, or when a record is edited...
  5. Rule Criterea: "Case Comment: Body not equal to null
  6. Create field update on the Case Comment object that set the value to "NOW()"
Basically, whenever a case comment is added - this workflow will trigger and set the Case field "Last Case Comment Date/Time" to the current time. You can now follow this field in your Chatter configuration and get alerts whenever a comment is added!

Sweet.

Thanks,
Josh Lipton
Advantix Solutions Group


Please forgive this really simple example trigger which I'm struggling to get working.

 

I have a Contract record with a custom link to create a new Invoice object. Multiple contracts (children) can reference an Invoice. However when I create a new Invoice, I want the Contract field called "Invoice" to be updated with the InvoiceNumbe, I pass the contract number as a string to the Invoice.

 

 

I've written the trigger in Exclipse, it loads in SF and executes when the Invoice is Updated (I think). But the contract is not updated with the invoice number?

 

trigger trgContractInvoiceNum on Invoices__c (after update) { for (Invoices__c inv : Trigger.new) { Contract ctr = [Select c.Id, c.ContractNumber From Contract c where c.ContractNumber = :inv.SourceContract__c]; ctr.SalesInvoice__c = inv.Id; ctr.Billing_Log__c = inv.Id; / for test purposes } }

 

What silly mistake am I making?

 

Thanks

I'd really appreciate some help on the final steps of getting the email agent to work for me.

I have set up a VPS (virtual private server) with Westhost on an Apache sever. (I know nothing about Java and Unix BTW!)

I have installed the EmailAgent on the server and configured it correctly. If I log in using Putty (a SSH client), change to the EmailAgent directory in the root and then execute the command

java -jar /EmailAgent/Email2Case.jar /EmailAgent/sfdcConfig.txt /EmailAgent/log4j.properties

then everything works beautifully, it moves emails, drops attachments onto the server and every couple of minutes, check for new emails.

However as soon as I close the PUTTY session, the Java application stops and emails are not processed.

I have tried putting the above command into a Cron jab (and I know it's being executed) but the EmailAgent app does not run.

What am I doing wrong. Is there a better way of setting this up? Any assistance would be much appreciated.

Thanks
Ian
I'm not a developer, but I was able to use the Email2Case sample code by running it on Windows in a batch file. However, we recently started using Google Apps as our email host, and since then I have been unable to get the Email2Case app to work. I'm hoping someone can tell me what obvious error I have made.

Error: No configuration value has been provided for the notification service UserID.

My best guess is that the app is complaining I haven't provided a username and password for SMTP authentication. But in the recent past I have been able to send email through this mail server without authenticating. It's a Speakeasy.net mail server and the machine is on a Speakeasy network.

In case it helps here are my config files:

<configFile>
    <sfdcLogin>
        <url>https://www.salesforce.com/services/Soap/u/7.0</url>
        <userName>zac@sarai.org</userName>
        <password>xxxxxxx</password>
        <loginRefresh>30</loginRefresh>
        <timeout>600</timeout>
    </sfdcLogin>
    <notify>
    <notifyEmail>support@sarai.org</notifyEmail>
        <from>support@sarai.org</from>
        <host>mail.speakeasy.net</host>
    <port>25</port>
        <service>com.sforce.mail.SMTPNotification</service>
    </notify>
    <attachments>
        <largeAttachmentDirectory>C:\Program Files\Salesforce.com\EmailAgent\Attachments</largeAttachmentDirectory>
        <largeAttachmentURLPrefix>file:C:\Documents and Settings\Administrator\Desktop\EmailAgent\Attachments</largeAttachmentURLPrefix>
        <largeAttachmentSize>0.5</largeAttachmentSize>
    </attachments>
    <services>
        <com.sforce.mail.EmailService>C:\Program Files\Salesforce.com\EmailAgent\email2case.txt</com.sforce.mail.EmailService>
    </services>
</configFile>

<configFile>
    <server1>
        <url>imap.gmail.com</url>
    <port>993</port>
        <protocol>imap</protocol>
        <userName>support@sarai.org</userName>
        <password>xxxxxxxx</password>
        <interval>2</interval>
        <inbox>INBOX</inbox>
        <readbox>INBOX/Processed</readbox>
        <errorbox>INBOX/Error</errorbox>
    </server1>
</configFile>

Thanks in advance for any assistance you can offer.
  • February 06, 2008
  • Like
  • 0