• Mark Vermaat
  • NEWBIE
  • 0 Points
  • Member since 2012

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 10
    Questions
  • 16
    Replies
I have been tasked with trying to figure out how to link a case (Created via API) to an already existing Opportunity.

I tried via web-to-case, creates new case but does not fill out lookup field. (Found that this will not auto populate Lookup Field) so had to ditch that attempt.

Now I have the Opportunity ID being saved in a hidden field on the case, then I tried a WFR. Which again is not going to do this for me, so I am stuck with writting a trigger (I think this is my only option) where it will take the ID from the Hidden Field and push it into the lookup (Lookups work on ID's if I am not mistaken)

My issue is, I am not super good at the whole trigger writing as I am just getting into more of the dev side now.

I have this as my trigger so far and was wondering if someone would be able to suggest or point out what I am doing wrong.

trigger OpportunityLookupSet on Case (before insert) {
    for(Case c : Trigger.new){
        if(c.Origin = 'ICE Cloud'&& c.MVDev__Opportunity_ID__c != null)}{
           c.MVDev__Opportunity_ID__c = c.MVDev__Linked_Opportunity__c;
        }
    }

}

WIth this one I get an error saying "AND operator can only be applied to Boolean expressions"  However I need to make sure that the origin is ICE Cloud (Hardcoded) and the Opportunity_ID__c is not blank.

Any help would be great.

Thanks in advance.

Mark
Hey Everyone,

I am playing with Streaming API and pushTopics.  I am trying to get it working for the Case object and I keep recieving the "Execute Anonymous Error - line breaks not allowed in string literals."  However, I do not see where the issue is:

Here is the pushTopic code:

PushTopic pushTopic = new PushTopic();
pushTopic.ApiVersion = 30.0;
pushTopic.Name = 'CaseNotifications’;
pushTopic.Description = 'Case Notifications’;
pushTopic.NotifyForFields = 'Referenced’;
pushTopic.NotifyForOperations = 'All’;
pushTopic.Query = 'Select id, caseNumber, accountId, contactId, status, priority, Reason FROM Case';
insert pushTopic;
system.debug('Created new PushTopic: ' + pushTopic.Id);

Anyone able to help me out with finding where the problem is?

Thanks in advance...

Mark

OK, this is starting to be painful.  I was tasked with setting up an email alert for when one of our Technicians training is about to expire.  I was trying to do this with just the typical email template however I have only been able to get 90% of the way there. 

 

The email alert has to contact specific people, and the only person I can't get it to contact is the Field Tech.

 

To explain how this works, I have the email setup on the Contact object, but the field rep is on the Account object.  I need to be able to bring in the email address of the field tech from the account object to the Contact object.  Adding a lookup field on the Contact is not an option.  Anyone have suggestions?  I am not against having to code something, but honestly don't even know where to start.  

 

Any suggestions from anyone would be appreciated.

 

Thanks.

Hey Everyone, 

 

I am building an Attachment Manager Type of application for my org.  I am still rather new at the apex advanced stuff and I am stuck.

 

Most of the code is good.  I am getting an error: Illegal assignment from LIST<SObject> to LIST<attachmentWrapperCont.aAttachment>

If I do not do it this way the wrapperclass does not work.  I need it to work so I can get the Selected attachments in there own list.

 

If any can give a suggestion on how to move forward that would be great.

 

Here is the code from my Controller.

public with sharing class attachmentWrapperCont {
	
	public string AttachmentName = Apexpages.currentPage().getParameters().get('Name');
	public string AttachmentType = Apexpages.currentPage().getParameters().get('contentType');
	private string qry {get;set;}
	public boolean selected {get;set;}
	
	//Collection of the Class/wrapper objects
	public List<aAttachment> attachmentList {get; set;}
	
	public class aAttachment{
		public Attachment attach {get;set;}
		public boolean selected {get;set;}
		
		//constructor
		public aAttachment(Attachment a){
			attach = a;
			selected = false;
		}
		
	}
	
	public void runQuery(){
		try{
			attachmentList = Database.query(qry = 'order by '+ sortField+ ' ' + sortDir + ' limit 50');
		}catch (Exception e){
			ApexPages.addMessage(new Apexpages.Message(Apexpages.severity.ERROR, 'Oops'));
		}
		//return attachmentList;
	}
	
	public PageReference processSelected(){
		//new list of attachments that are selected.
		List<Attachment> selectedAttachments = new List<Attachment>();
		
		//cycle through list to check for selected
		for(Attachment att: attachmentList()){
			if(att.selected == true){
				selectedAttachments.add(att);
			}
		}
		
		//List of selected attachments and can do any logic on it
		System.debug('These are the selected Attachments...');
		for(Attachment attach: selectedAttachments){
			system.debug(attach);
		}
		attachmentList = null;
		
		return null;
	}
	
	public PageReference search(){
		qry = 'SELECT id, name, ContentType, bodyLength FROM Attachment WHERE AttachmentName != nill';
		if(!AttachmentType.equals(''))
			qry += ' AND attachmentType LIKE \'%' +String.escapeSingleQuotes(AttachmentType)+'%\'';
		if(!AttachmentName.equals(''))
			qry += ' AND attachmentName LIKE \'%' +String.escapeSingleQuotes(AttachmentName)+ '%\'';
		runQuery();
		
		return null;
	}
	
	//Wrapper/container class In this example a wrapper class contains both the standard salesforce object Contact and a Boolean value
	
	
	
	public string sortDir{
		get{
			if(sortDir == null){
				sortDir = 'asc';
			}
			return sortDir;
		}
		set;
	}
	
	public string sortField {
		get{
			if(sortField == null){
				sortField = 'AttachmentName';
			}
			return sortField;
		}
		set;
	}
	
	
	
}

 Any help would be greatly appreciated.

 

Thanks a ton in advance....

I have created a Attachment Manager type setup, and the only thing is I am not able to pass the ID of the attachment to a new window.  It opens with nothing in it.

 

Any idea how I could fix this maybe?

 

   <apex:actionStatus id="status" startText="Searching... please wait..."/>
      <apex:pageBlockSection title="Search Results" id="resultsBlock" columns="1">
        <apex:pageBlockTable value="{!searchResults}" var="item" rendered="{!NOT(ISNULL(searchResults))}">
        <apex:column headerValue="Delete">
            <apex:commandLink action="{!deleteAttachment}" onclick="if(!confirm('Are you sure?')) return false;">Del
                <apex:param value="{!item.id}" name="idToDel" assignTo="{!AttachId}"/>
            </apex:commandLink>
            </apex:column>
            <apex:column value="{!item.id}" HeaderValue="Attachment ID" width="100"/>
          <apex:column headerValue="Name of Attachment   (Click to view)" >
            <apex:outputLink value="{!URLFOR($Action.Attachment.Download,item.id)}" target="_blank">
            View</apex:outputLink>
            </apex:column>

 The code displays the list, as well as the option to Delete it, (and it works) however when I click on the View, it opens a new window but nothing is pulled over to view.  ?? Any idea?

I am working on trying to develop a class to display just the attachments on our Salesforce Instance.  Kind of like the Attachment Manager that is available.  However, I will be having it displayed in a VisualForce Page.  Trying to query from the Database, but unsure of how to get the informaiton from all the attachments, not just related to a single case.  Any ideas?

I have a question.  I am trying to design a email attachment stripper.  For the sole reason of removing signiture images from emails that come in.  We used to have one for our system but with the amount of trafic we recieve, it was working overtime and keep causing errors.

 

I am fairly new to the apex language and would like any suggestions how to get it started.

 

Thanks in advance for any ideas.

 

Mark 

I have a little problem here, I have created a custom clone option for my support team and when they clone the case I have the VF Clone Case page display the old and new case numbers as links.  

 

However when they click on either one, it does not open the page.  Is there a specific way to get it to open in the parent frame? 

 

Here is the pageblock of code with the links:

 

 

   <apex:pageBlock title="Case Clone Summary">
    <table cellpadding="10">
    <tr><td>Original Case Number: </td> <td>{!CaseNumberOld}</td> <td><a href="/{!CaseIdOld}"></a></td></tr>
    <tr><td>New Case Number: </td><td>{!CaseNumberNew}</td><td><a href="/{!CaseIdNew}"></a></td></tr>
    
    </table>
    </apex:pageBlock>

I have created a clone case option which clones everything in the case, however my Team is asking for a field in the visual force page to set the case owner so that they dont have to open the cloned case, they can just assign it to the person or queue.... Here is what I have so far:

 

<apex:page standardController="Case"
extensions="CaseClone"
action="{!testthis}">
<apex:pageBlock title="Hello {!$User.FirstName}!"><br />


Your support case has been cloned!<br /><br />
<i><b>Warning! Do not hit "refresh" on your browser or your case will be cloned AGAIN</b></i><br />
<br /><br />
<table cellpadding="10">
<tr>
<td>Original Case Number:</td>
<td>{!CaseNumberOld}</td>
<td><a href="/{!CaseIdOld}">Go to this case...</a></td></tr>
<tr>
<td>New Case Number:</td>
<td>{!CaseNumberNew}</td>
<td> <a href="/{!CaseIdNew}">Go to this case...</a>:</td>
</tr>
</table>
<br/><br />
</apex:pageBlock>
</apex:page>

 

The issue is that the action taken is what clones the case, and if I were to setup something to input the case owner and set it, it would have to go before the action wouldnt it?  I was thinking it could just modify the record after it is created but to do that from VF I dont know.  

 

Any help would be appreciated....

 

Thanks

Customizing Liveagent Chat window, and all seems to be going well except for one thing.  

 

I have worked with the custom page setup that it says, however the wait messaging stays at the top of the page.  Would this have to be a javascript way to refresh the page?  I did manage to have it show the wait dialog ex: "please wait while we connect you to an agent" and when connected it keeps displaying that message at the top.  

 

Suggestion on how to get the page to refresh or re-paint?  

 

Sorry I am new to the Visualforce pages, and still think in java terms. :)  

 

I do appreciate all the suggestions you have provided.

Hey Everyone,

I am playing with Streaming API and pushTopics.  I am trying to get it working for the Case object and I keep recieving the "Execute Anonymous Error - line breaks not allowed in string literals."  However, I do not see where the issue is:

Here is the pushTopic code:

PushTopic pushTopic = new PushTopic();
pushTopic.ApiVersion = 30.0;
pushTopic.Name = 'CaseNotifications’;
pushTopic.Description = 'Case Notifications’;
pushTopic.NotifyForFields = 'Referenced’;
pushTopic.NotifyForOperations = 'All’;
pushTopic.Query = 'Select id, caseNumber, accountId, contactId, status, priority, Reason FROM Case';
insert pushTopic;
system.debug('Created new PushTopic: ' + pushTopic.Id);

Anyone able to help me out with finding where the problem is?

Thanks in advance...

Mark

Hey Everyone, 

 

I am building an Attachment Manager Type of application for my org.  I am still rather new at the apex advanced stuff and I am stuck.

 

Most of the code is good.  I am getting an error: Illegal assignment from LIST<SObject> to LIST<attachmentWrapperCont.aAttachment>

If I do not do it this way the wrapperclass does not work.  I need it to work so I can get the Selected attachments in there own list.

 

If any can give a suggestion on how to move forward that would be great.

 

Here is the code from my Controller.

public with sharing class attachmentWrapperCont {
	
	public string AttachmentName = Apexpages.currentPage().getParameters().get('Name');
	public string AttachmentType = Apexpages.currentPage().getParameters().get('contentType');
	private string qry {get;set;}
	public boolean selected {get;set;}
	
	//Collection of the Class/wrapper objects
	public List<aAttachment> attachmentList {get; set;}
	
	public class aAttachment{
		public Attachment attach {get;set;}
		public boolean selected {get;set;}
		
		//constructor
		public aAttachment(Attachment a){
			attach = a;
			selected = false;
		}
		
	}
	
	public void runQuery(){
		try{
			attachmentList = Database.query(qry = 'order by '+ sortField+ ' ' + sortDir + ' limit 50');
		}catch (Exception e){
			ApexPages.addMessage(new Apexpages.Message(Apexpages.severity.ERROR, 'Oops'));
		}
		//return attachmentList;
	}
	
	public PageReference processSelected(){
		//new list of attachments that are selected.
		List<Attachment> selectedAttachments = new List<Attachment>();
		
		//cycle through list to check for selected
		for(Attachment att: attachmentList()){
			if(att.selected == true){
				selectedAttachments.add(att);
			}
		}
		
		//List of selected attachments and can do any logic on it
		System.debug('These are the selected Attachments...');
		for(Attachment attach: selectedAttachments){
			system.debug(attach);
		}
		attachmentList = null;
		
		return null;
	}
	
	public PageReference search(){
		qry = 'SELECT id, name, ContentType, bodyLength FROM Attachment WHERE AttachmentName != nill';
		if(!AttachmentType.equals(''))
			qry += ' AND attachmentType LIKE \'%' +String.escapeSingleQuotes(AttachmentType)+'%\'';
		if(!AttachmentName.equals(''))
			qry += ' AND attachmentName LIKE \'%' +String.escapeSingleQuotes(AttachmentName)+ '%\'';
		runQuery();
		
		return null;
	}
	
	//Wrapper/container class In this example a wrapper class contains both the standard salesforce object Contact and a Boolean value
	
	
	
	public string sortDir{
		get{
			if(sortDir == null){
				sortDir = 'asc';
			}
			return sortDir;
		}
		set;
	}
	
	public string sortField {
		get{
			if(sortField == null){
				sortField = 'AttachmentName';
			}
			return sortField;
		}
		set;
	}
	
	
	
}

 Any help would be greatly appreciated.

 

Thanks a ton in advance....

I have created a Attachment Manager type setup, and the only thing is I am not able to pass the ID of the attachment to a new window.  It opens with nothing in it.

 

Any idea how I could fix this maybe?

 

   <apex:actionStatus id="status" startText="Searching... please wait..."/>
      <apex:pageBlockSection title="Search Results" id="resultsBlock" columns="1">
        <apex:pageBlockTable value="{!searchResults}" var="item" rendered="{!NOT(ISNULL(searchResults))}">
        <apex:column headerValue="Delete">
            <apex:commandLink action="{!deleteAttachment}" onclick="if(!confirm('Are you sure?')) return false;">Del
                <apex:param value="{!item.id}" name="idToDel" assignTo="{!AttachId}"/>
            </apex:commandLink>
            </apex:column>
            <apex:column value="{!item.id}" HeaderValue="Attachment ID" width="100"/>
          <apex:column headerValue="Name of Attachment   (Click to view)" >
            <apex:outputLink value="{!URLFOR($Action.Attachment.Download,item.id)}" target="_blank">
            View</apex:outputLink>
            </apex:column>

 The code displays the list, as well as the option to Delete it, (and it works) however when I click on the View, it opens a new window but nothing is pulled over to view.  ?? Any idea?

I am working on trying to develop a class to display just the attachments on our Salesforce Instance.  Kind of like the Attachment Manager that is available.  However, I will be having it displayed in a VisualForce Page.  Trying to query from the Database, but unsure of how to get the informaiton from all the attachments, not just related to a single case.  Any ideas?

I have a question.  I am trying to design a email attachment stripper.  For the sole reason of removing signiture images from emails that come in.  We used to have one for our system but with the amount of trafic we recieve, it was working overtime and keep causing errors.

 

I am fairly new to the apex language and would like any suggestions how to get it started.

 

Thanks in advance for any ideas.

 

Mark 

I have a little problem here, I have created a custom clone option for my support team and when they clone the case I have the VF Clone Case page display the old and new case numbers as links.  

 

However when they click on either one, it does not open the page.  Is there a specific way to get it to open in the parent frame? 

 

Here is the pageblock of code with the links:

 

 

   <apex:pageBlock title="Case Clone Summary">
    <table cellpadding="10">
    <tr><td>Original Case Number: </td> <td>{!CaseNumberOld}</td> <td><a href="/{!CaseIdOld}"></a></td></tr>
    <tr><td>New Case Number: </td><td>{!CaseNumberNew}</td><td><a href="/{!CaseIdNew}"></a></td></tr>
    
    </table>
    </apex:pageBlock>

I have created a clone case option which clones everything in the case, however my Team is asking for a field in the visual force page to set the case owner so that they dont have to open the cloned case, they can just assign it to the person or queue.... Here is what I have so far:

 

<apex:page standardController="Case"
extensions="CaseClone"
action="{!testthis}">
<apex:pageBlock title="Hello {!$User.FirstName}!"><br />


Your support case has been cloned!<br /><br />
<i><b>Warning! Do not hit "refresh" on your browser or your case will be cloned AGAIN</b></i><br />
<br /><br />
<table cellpadding="10">
<tr>
<td>Original Case Number:</td>
<td>{!CaseNumberOld}</td>
<td><a href="/{!CaseIdOld}">Go to this case...</a></td></tr>
<tr>
<td>New Case Number:</td>
<td>{!CaseNumberNew}</td>
<td> <a href="/{!CaseIdNew}">Go to this case...</a>:</td>
</tr>
</table>
<br/><br />
</apex:pageBlock>
</apex:page>

 

The issue is that the action taken is what clones the case, and if I were to setup something to input the case owner and set it, it would have to go before the action wouldnt it?  I was thinking it could just modify the record after it is created but to do that from VF I dont know.  

 

Any help would be appreciated....

 

Thanks

This should not be confused with my previous message related to the pre-chat form.

 

In the post chat form of Live Agent, the developer documentation provides an example of how to spit out some values about the chat (like that would be even remotely interesting to the customer) and at the end there's the fantastically unhelpful comment: <!-- Implement your post-chat message, form, or survey here -->

 

Nowhere does it say how I can get hold of the transcript object to store the values. I just want to implement a simple customer satisfaction form in the post-chat.

 

Does anyone have any pointers or examples of how this can be accomplished? 

 

Thanks, Finn Arild.