• Leebies
  • NEWBIE
  • 0 Points
  • Member since 2007

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 13
    Questions
  • 11
    Replies

Hi,  I have created the below trigger using code from the Cookbook.

 

 

trigger NewCase on Service_Reports__c (after insert) { List<Case> cases = new List<Case>(); for (Service_Reports__c newCase: Trigger.New) { if (newCase.Name != null) { cases.add(new Case(Subject = 'Remedial Case', Type = 'Remedial Work')); } } insert cases; }

 

 I need some help however on making sure that when the case is created, it is linked back to the service report.  At the moment it just creates a new case and doesnt relate to the Service Report in the Case's Service Report lookup!   Of course I understand thats because I havent told it to, but I am struggling to figure out how to get it to!!!

 

Can anyone help?

 

Thanks!

 

We are using External Attachements 1.1.  We find that now and again for no apparent reason, we cannot attach a file.  We get the  "The file is not successfully attached" error.

 

We always attach using the network path so our folks have a shortcut to the shared drive on their desktop that goes \\server\salesforce\quotes for example.

 

They then select the file and 9 times out of 10, there is no issue.  Its just for some reason now and again, with no explanation it doesnt allow us to attach.

 

https://www.salesforce.com/appexchange/detail_overview.jsp?NavCode__c=&id=a0330000004N39lAAC

 

I wrote the following trigger (based on the one from the Cook Book)

Code:
trigger NewCase on Service_Reports__c (after insert) {
    List<Case> cases = new List<Case>();
    for (Service_Reports__c newCase: Trigger.New) {
        if (newCase.Name != null) {
            cases.add(new Case(Subject = 'Remedial Case', Type = 'Remedial Work'));
        }
    }

    insert cases;
}

 
Problem is I dont know how to deploy it from Sandbox to Live.  In Eclipse there is no deploy button.  I read a lot of comments about developing a test class, then running it before a Deploy, but I dont know a) what one of those is, or how to go about it!

Would appreciate any help!
Hi!  How can I create a Workflow - To create a new Case with Predefined information in it?

I can setup a worlkflow to create a task easy enough but thats it :(

Thanks!
OK, I have the following issue.  I have multiple Object Related to each other.

For example:

Assets, Orders, Opps and Projects are all linked together so you can add the relationship within any of the page view.

The problem I do have tho is if I go to an Opp that is related to a project and order, and I go to create a new Asset, it only pulls the Opp into the Opp field and doesnt pull the related Orders or Projects.

Is there a way around this?

Thanks.
  • September 28, 2007
  • Like
  • 0
Hi Folks,

I am struggling to disable the "On Stage Change" email that goes out to people!  I can't find it in Workflow Rules or any email settings and yet people are getting emails everytime an oportunity has a change in its Stage!  I am getting a lot of complaints and yet can not get them to stop! :(  Pls Help!
Hi,  I customised the Asset Section to have 4 extra date fields to record the future service dates due on an asset.

If we then use the connector to upload dates in bulk it will only allow us to update a row.  If we sellect multiple rows with dates in and update them we get this:



Does anyone have any ideas?  Its beat me!

Yours sadly,
Me!
Hi

I have a "Service Date Due on" field where I input the date of when a service is due.

How do I set a trigger for an email to be sent 7 days before the date specified?

Thanks in advance :)
Hi,

We recently opted for multi currency, however we have now found that when generating a quote via mailmerge, we get GBP or EUR instead of the symbol.  Is there a work around for this?

Thanks.
Hi,
 
I think this is not possible, or could be available in a future release but here goes and perhaps someone could clarify.
 
I have written some Javascript that will paste some information into a text box when you press a button however it obviously only runs when displaying the page and not in edit mode.
 
Is there any way around this?
 
Thanks.
Hello All,
 
How do I find the WhatID for a custom object?
 
Thanks in advance :)
Hi!
 
I am trying to display tasks and events using the Timeline S-Control Mashup for a custom object.  In this example called projects1.  I took out all the code for the opportunities, cases etc as I dont wish to use those features.  The issue is, I cant get the tasks or events to appear on the timeline.  I assume it is because I need to set the whatid, however I dont know where to put it.  I THINK the what ID is the 3 letters in the link example a01.  Can someone help me identify what the whatid is and where it goes in the script?
 
Here is the script that I have edited so far:
 
Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Timeline</title>
 <link  href="/dCSS/Theme2/default/common.css" type="text/css" media="handheld,print,projection,screen,tty,tv" rel="stylesheet" >

<!-- Include the MIT timeline library and CSS-->
{!INCLUDE($SControl.Timeline_CSS)}
{!INCLUDE($SControl.Timeline_mit_lib)}

<!-- Apex AJAX connection library change-->
<script src="/soap/ajax/8.0/connection.js" type="text/javascript"></script>

<script type="text/javascript">

var theTimeLine; var eventSource;
var baseURL = window.location.protocol + '//' + window.location.hostname;
var isProject = new Boolean("{!$Request.eid}" == "{!Project1__c.Id}");
// see what tab we are called from
function validId(id) { return ("{!$Request.eid}" != null && "{!$Request.eid}" != "" && "{!$Request.eid}" === id); }

var hasActivities = new Boolean( isProject == true );
function _WhatId() { 
 if (isProject == true)  return "{!Select p.Id from Project1__c p}";
 return null;
}
var WhatId = _WhatId(); 

/**************************
 * load the timeline UI, then query for events to add
 * all the events are added async to give a quicker load
 */
function initPage() {
 //build the timeline widget
 eventSource = new Timeline.DefaultEventSource();
 
 var theme = Timeline.ClassicTheme.create();
 theme.event.label.width = 300; // px  this will truncate the labels that appear on the timline
 //theme.event.bubble.width = 250;
 //theme.event.bubble.height = 200;
 theme.ether.backgroundColors.unshift("#f3f3ec");
 
 // set up the bands of info in the display
 var bandInfos = [
  Timeline.createBandInfo({
   eventSource: eventSource, date: Date(),
   width: "80%",    intervalUnit: Timeline.DateTime.MONTH,
   intervalPixels: 100,  theme: theme
  }),
  Timeline.createBandInfo({
   showEventText: false,
   trackHeight: 0.5,   trackGap: 0.2,
   eventSource: eventSource, date: Date(),
   width: "20%",    intervalUnit: Timeline.DateTime.YEAR,
   intervalPixels: 200
  })
 ];
 bandInfos[1].syncWith = 0;
 bandInfos[1].highlight = true;
 theTimeLine = Timeline.create(document.getElementById("my-timeline"), bandInfos);
 
 /*************
  * begin DATA queries
  * each query kicks off an async callback to plot/load the results, does not wait for all before drawing.
  * more can be added to support custom objects, to support custom objects, test for merge fields  
  * decide what related records have dates, and create a layout callback for each.
  * this can also be used to support one scontrol on many different object page layouts
  * so, contact, opportunity, account or case can all run from this one scontrol
  * we do assume it is an inline scontrol 
  */ 
 if ( hasActivities == true && WhatId != null ) {
  //get all tasks related to this object ( must have a WhatId)
  sforce.connection.query(
   "Select Id,Subject,Status,ActivityDate,Description,CreatedDate,Owner.FirstName,Owner.LastName, Who.FirstName, Who.LastName from Task where WhatId='"+ WhatId +"'", 
   layoutTasks);
  // events
  sforce.connection.query(
   "Select Id, Subject, Location, ActivityDateTime,ActivityDate, IsAllDayEvent, DurationInMinutes, Description, Owner.FirstName,Owner.LastName, Who.FirstName, Who.LastName from Event where WhatId='"+ WhatId + "' order by ActivityDate",
   layoutEvents);
 }
 
}
/* 
 * layout callbacks, gets a list of query results, formats a timeline entry and bubble contents
 * when constructing data.events array of objects to add via loadJSON, the following are available
 * 
 * { start: 
  end: 
  title:
  link:  'parent:link...'
  latestStart: null,
  earliestEnd: null,
  isDuration: false,
  description: 
  image: img,
  icon: img,
  color: "#999",
  textColor: null,
  onclick: "javascript:..."
  }
 Note, for IE and IE7 the last data element must not have a comma following it
 */

function layoutTasks(qr) { layoutActivity(qr, "/img/icon/tasks16.png"); }
function layoutEvents(qr) { layoutActivity(qr, "/img/icon/calendar16.png"); }
function layoutTasksWhat(qr) { layoutActivityWhat(qr, "/img/icon/tasks16.png"); }
function layoutEventsWhat(qr) { layoutActivityWhat(qr, "/img/icon/calendar16.png"); }

// activities may have duplicates on an account for example, keep a list to avoid 
var seen = [];
// this callback loads tasks into the timeline
function layoutActivityWhat(qr,img) {
 loadJSON ( map ( qr.getArray('records'), function(rec,idx,ary) { 
  if ( seen[rec.Id] ) { return null; } else { seen[rec.Id] = rec.Id;}
  var stdate = rec.getDate('ActivityDate');
  if (!stdate) { stdate = rec.getDateTime('CreatedDate'); }
  return {
   start: stdate,
   title: rec.Subject + (rec.What && rec.What.Name — ', '+rec.What.Name : ''),
   link: 'parent:/' + rec.Id, 
   description: 'description: ' + (rec.Description – rec.Description:'') + 
     (rec.Who && rec.Who.FirstName && rec.Who.LastName ˜
      '<br>contact: ' + rec.Who.FirstName + ' '+rec.Who.LastName : '') +
      "<br>assigned to: " + rec.Owner.FirstName + " " + rec.Owner.LastName,
   image: img,
   icon: img,
   color: "#999" }
 } ) );
}

// this callback loads tasks into the timeline
function layoutActivity(qr,img) {
 loadJSON ( map ( qr.getArray('records'), function(rec,idx,ary) { 
  if ( seen[rec.Id] ) { return null; } else { seen[rec.Id] = rec.Id;}
  var stdate = rec.getDate('ActivityDate');
  if (!stdate) { stdate = rec.getDateTime('CreatedDate'); }
  return {
   start: stdate,
   title: rec.Subject + (rec.Who && rec.Who.FirstName && rec.Who.LastName ™
         ', '+rec.Who.FirstName + ' '+rec.Who.LastName : ''),
   link: 'parent:/' + rec.Id, 
   description: 'description: ' + (rec.Description ? rec.Description:'') + 
     (rec.Who && rec.Who.FirstName && rec.Who.LastName ?
      '<br>contact: ' + rec.Who.FirstName + ' '+rec.Who.LastName : '') +
      "<br>assigned to: " + rec.Owner.FirstName + " " + rec.Owner.LastName,
   image: img,
   icon: img,
   color: "#999" };
 } ) );
}

// some helper functions
// take an array of events, load them into a data object and pass to loadJSON 
function loadJSON (events) { 
 if (!events || events.length <1) return; 
 var data = {}; 
 data.events = events; 
 eventSource.loadJSON(data,baseURL); // eventSource is part of the Timeline API
}
// call a function on each member of the array, return an array 
// of the results of the callbacks
function map(anArray /* Array */, callback /* Function */){
 var outArr = [];
 for(var i=0,l=anArray.length; i<l; i++){ 
  var topush = callback(anArray[i], i, anArray);
  if (topush != null) {
   outArr.push( topush );
  }
 }
 return outArr;
}

/***********************
 * function onResize()
 * If the page is resized, the timeline is resized to match
 * this waits for resize to finish 1/2 second
 */
var resizeTimerID = null; 
function onResize() {
 if (resizeTimerID == null) {
  resizeTimerID = window.setTimeout( function() { resizeTimerID = null; theTimeLine.layout();}, 500 );
 }
}


</script> <!--  main functions -->
</head>
<body onload="javascript:initPage();" onresize="javascript:onResize();" >
<div id="my-timeline" style="height:300px; border: 1px solid #aaa"></div>
</body>
</html>

 
Hello,
 
Total newbie here.  I have been creating an object in our main Salesforce account not realising that there was a development account we could have for us to test our changes on.
 
I would like to therefore export the object and import it into our development account so that I am no affecting any of our live data and users experience.
 
Is this possible?
 
Thanks in advance,
I wrote the following trigger (based on the one from the Cook Book)

Code:
trigger NewCase on Service_Reports__c (after insert) {
    List<Case> cases = new List<Case>();
    for (Service_Reports__c newCase: Trigger.New) {
        if (newCase.Name != null) {
            cases.add(new Case(Subject = 'Remedial Case', Type = 'Remedial Work'));
        }
    }

    insert cases;
}

 
Problem is I dont know how to deploy it from Sandbox to Live.  In Eclipse there is no deploy button.  I read a lot of comments about developing a test class, then running it before a Deploy, but I dont know a) what one of those is, or how to go about it!

Would appreciate any help!
Hi!  How can I create a Workflow - To create a new Case with Predefined information in it?

I can setup a worlkflow to create a task easy enough but thats it :(

Thanks!
Hi Folks,

I am struggling to disable the "On Stage Change" email that goes out to people!  I can't find it in Workflow Rules or any email settings and yet people are getting emails everytime an oportunity has a change in its Stage!  I am getting a lot of complaints and yet can not get them to stop! :(  Pls Help!
Hi,  I customised the Asset Section to have 4 extra date fields to record the future service dates due on an asset.

If we then use the connector to upload dates in bulk it will only allow us to update a row.  If we sellect multiple rows with dates in and update them we get this:



Does anyone have any ideas?  Its beat me!

Yours sadly,
Me!
Hi

I have a "Service Date Due on" field where I input the date of when a service is due.

How do I set a trigger for an email to be sent 7 days before the date specified?

Thanks in advance :)
Hello,
 
Total newbie here.  I have been creating an object in our main Salesforce account not realising that there was a development account we could have for us to test our changes on.
 
I would like to therefore export the object and import it into our development account so that I am no affecting any of our live data and users experience.
 
Is this possible?
 
Thanks in advance,